if any checkbox.value = 1 then

smiler44

Registered User.
Local time
Today, 09:32
Joined
Jul 15, 2008
Messages
671
can not work out what the correct code should be, but this I what I am trying to do:-

if form1. anycheckbox.value = 1 then
msgbox("hi")
end if

thnaks
smiler44
 
Re: if any checkbox.value = 1 then (solved)

Thank you. Very useful. It took me a few goes but I managed to modify the code to whats below and from that managed to get the code to exit the routine if any checkbox was checked(ticked). Thank you again Smiler44

Private Sub Command1_Click()
' this code will look at checkbox 1 and 2. if one of them is checked then
' a message box is displayed. if both are checked then message box displayed twice
Dim Check1, Check2
Dim checkbox
Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is checkbox Then

If ctl.Value = 1 Then MsgBox ("1")

End If
Next ctl
End Sub
 

Users who are viewing this thread

Back
Top Bottom