I have problems passing a controlname to a function in this code.
Private Sub chkAlleBestellen_Click()
If chkAlleBestellen.Value = -1 Then
chkSelectAll -1, Forms!frmOverzichtProducten.Form, chkBestel.Name
Else
chkSelectAll 0, Forms!frmOverzichtProducten.Form, chkBestel.Name
End If
End Sub
Public Function chkSelectAll(waarde, formulierkeuze, ByRef objectnaam)
On Error GoTo Whoops
Dim frm As Form
Dim CNaaam As Control
Dim rst As dao.Recordset
Set frm = formulierkeuze
CNaaam = objectnaam
Set rst = frm.RecordsetClone
rst.MoveFirst
With rst
Do Until .EOF
.Edit
!cnaam = waarde
.Update
.MoveNext
Loop
End With
'Form.Refresh
OffRamp:
Exit Function
Whoops:
MsgBox "Error #" & Err & ": " & Err.Description
frm.objectnaam.Value = 1
Resume OffRamp
End Function
Thanks for your time and knowledge.
Private Sub chkAlleBestellen_Click()
If chkAlleBestellen.Value = -1 Then
chkSelectAll -1, Forms!frmOverzichtProducten.Form, chkBestel.Name
Else
chkSelectAll 0, Forms!frmOverzichtProducten.Form, chkBestel.Name
End If
End Sub
Public Function chkSelectAll(waarde, formulierkeuze, ByRef objectnaam)
On Error GoTo Whoops
Dim frm As Form
Dim CNaaam As Control
Dim rst As dao.Recordset
Set frm = formulierkeuze
CNaaam = objectnaam
Set rst = frm.RecordsetClone
rst.MoveFirst
With rst
Do Until .EOF
.Edit
!cnaam = waarde
.Update
.MoveNext
Loop
End With
'Form.Refresh
OffRamp:
Exit Function
Whoops:
MsgBox "Error #" & Err & ": " & Err.Description
frm.objectnaam.Value = 1
Resume OffRamp
End Function
Thanks for your time and knowledge.