Hi
Admitedly, I am not that good at writing functions; actually I suck at it
However, we needed to uncheck all checkboxs in a form at once, so instead of doing each one, one by one,
I managed to write this bit of code:
Dim Ctrl As Control
For Each Ctrl In Me.Controls
If TypeOf Ctrl Is CheckBox Then
Ctrl.Value = False
End If
Next Ctrl
Now, realizing that I may use that several times over in this project, I thought it might be a good idea to try to write a little function for this.
Here is my first attempt
Private Function IsCheckBoxChecked(ByRef Checkbox As Control) As Boolean
Dim Ctrl As Control
For Each Ctrl In Me.Controls
If TypeOf Ctrl Is Checkbox Then
IsCheckBoxChecked = True
Exit Function
End If
Next Ctrl
IsCheckBoxChecked = False
End Function
I am not sure if this is written correctly???
If not, can someone please help me out?
Also, how would I call it up in a Sub??
Thank you
Mark