Help with if "no", then must select.." required information in a .

  • Thread starter Thread starter jayjellobean
  • Start date Start date
J

jayjellobean

I have two fields. The first is a "yes/no" field. If the first field is "no",
the user must select an option from the combo box in the second field. How do
I do this? Any information would be greatly appreciated.
 
a simple thing to do would be that if the Yes No box was = yes then just make
the combo not enabled so they can't use it

Note for yes no boxes yes = -1 and no =0

Private Sub txtBox1_AfterUpdate()
If Me.txtBox1 = -1 Then
Me.ComboName.Enabled = False
End If
End Sub

Or a message (if you want one) but don't forget that too many message make a
form a little irritating ?

Private Sub txtBox1_AfterUpdate()
If Me.txtBox1 = 0 Then
MsgBox "Don't forget to select something from the combo", vbOKOnly, "Reminder"
End If
End Sub


Hth
 
a simple thing to do would be that if the Yes No box was = yes then just make
the combo not enabled so they can't use it

Note for yes no boxes yes = -1 and no =0

Private Sub txtBox1_AfterUpdate()
If Me.txtBox1 = -1 Then
Me.ComboName.Enabled = False
End If
End Sub

I'd suggest putting the same code in the form's Current event so that when you
navigate to an existing record it sets the combo appropriately.
 
Back
Top