Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forcing Fields

Status
Not open for further replies.

Dina01

Programmer
Mar 26, 2002
204
CA
Hello,

I have a form that contains 4combo box, but what I am trying to do is, that if ever the user tries to fill up the 2nd combo box before the 1st, he shouldn't be able, and if he tries to fill up the 1st, 3, 4 well he shouldn't be able to fillup the 3 and 4 combo box without filling the 2.

Therfore he has no choice to fill everything in order.

This is the code I wrote.
But it doesn't work properly.
******************

Private Sub Agt2_GotFocus()

If IsNull(Agt1) Then
Agt1.SetFocus
MsgBox "Vous devez choisir un agent", vbInformation
End If
Me.Refresh
End Sub
Private Sub Agt3_GotFocus()

If IsNull(Agt1) And _
IsNull(Agt2) Then
Agt2.SetFocus
MsgBox "Vous devez choisir un agent", vbInformation
End If
Me.Refresh
End Sub

Private Sub Agt4_GotFocus()

If IsNull(Agt1) And _
IsNull(Agt2) And _
IsNull(Agt3) Then
Agt3.SetFocus
MsgBox "Vous devez choisir un agent", vbInformation
End If
Me.Refresh
End Sub


Can someone tellme what I am doing wrong...
 
disregard this message. I found the solution

Thanks Anyways. I just replaced the And by Or
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top