View Full Version : Test 2 combos for data


BarryMK
08-07-2008, 02:50 AM
I'm using the code below to prompt users to fill in two combos before moving to the next tab page on my form.
It works when both combos are empty but if I update the first combo and press the LOST button again it fires the setfocus event. Is this a "null" problem?


Private Sub cmdLost_Click()
Dim Msg As String
If IsNull(Me.cmbBreed) Or (Me.cmbColour) Then
MsgBox "Fill in Breed and Colour Now." & vbCrLf & "Then click the LOST button again.", vbInformation, "Required fields!"
DoCmd.CancelEvent
Else
Me.Mutt.SetFocus
End If
End Sub

BarryMK
08-07-2008, 02:53 AM
Worked it out! Just needed another IsNull before the second combo.


Private Sub cmdLost_Click()
Dim Msg As String
If IsNull(Me.cmbBreed) Or IsNull(Me.cmbColour) Then
MsgBox "Fill in Breed and Colour Now." & vbCrLf & "Then click the LOST button again.", vbInformation, "Required fields!"
DoCmd.CancelEvent
Else
Me.Mutt.SetFocus
End If
End Sub