gvirden
Dec 29th, 1999, 09:14 PM
I got this code from MartinLiss and it works great! This code writes to a field called reason all the reasons(strings) that are checked from mutiple checkboxes after a _click() occurs.
For Each MyCheckBoxes In Controls
If TypeOf MyCheckBoxes Is CheckBox Then
If MyCheckBoxes.Value = vbChecked Then
strReasons = strReasons & MyCheckBoxes.Caption
End If
End If
Next
My problem is this. The event is cmdfeed_click(). Txtfeed is the amount of feed fed and typed in by the user. Well, if they don't type in anything into txtfeed, and click cmdfeed then I want this to happen.
If txtfeed = "" And MyCheckBoxes.Value = 0 Then
MsgBox ("Go back and check a reason for no feed."), , "Check a Reason"
Exit Sub
Else: txtfeed = "" And MyCheckBoxes.Value = 1
txtfeed = 0
End If
What I am trying to do is this. If the user enters txtfeed = " " and no checkboxes have been checked, then I want that msgbox to make them go back and check a box (a reason). If they have a box checked and they enter txtfeed = " " I want to write 0 in the field. I get a runtime error 91.
Thanks again.
For Each MyCheckBoxes In Controls
If TypeOf MyCheckBoxes Is CheckBox Then
If MyCheckBoxes.Value = vbChecked Then
strReasons = strReasons & MyCheckBoxes.Caption
End If
End If
Next
My problem is this. The event is cmdfeed_click(). Txtfeed is the amount of feed fed and typed in by the user. Well, if they don't type in anything into txtfeed, and click cmdfeed then I want this to happen.
If txtfeed = "" And MyCheckBoxes.Value = 0 Then
MsgBox ("Go back and check a reason for no feed."), , "Check a Reason"
Exit Sub
Else: txtfeed = "" And MyCheckBoxes.Value = 1
txtfeed = 0
End If
What I am trying to do is this. If the user enters txtfeed = " " and no checkboxes have been checked, then I want that msgbox to make them go back and check a box (a reason). If they have a box checked and they enter txtfeed = " " I want to write 0 in the field. I get a runtime error 91.
Thanks again.