If "yes" then require data in another field

G

Guest

I have two fields on a form: one a "check box" and another a "combo list"

If the check box = Yes, then I want the field for the combo list to require
data. I can make it go the field that I want the date inserted, but I cannot
seem to figure out how to make it mandatory for the user to insert data from
the drop down list if the check box = yes.
 
R

ruralguy via AccessMonster.com

Use the Exit event of the ComboBox and
Cancel = True If Len(Me.ComboBox & "") = 0
 
G

Guest

I tried this and it creates an error and tells me to debug. Is there an "if"
statement that I could utilize? Something to the effect - If [checkbox1] =
true then ComboBox1 Is Not Null

I know that's not how to write it, but I'm just learning visual basic and am
not for sure how to write it.
 
P

Pieter Wijnen

Private Sub Form_BeforeUpdate()
If Me.Check1.Value = True And IsNull(Me.Combo1.Value) Then
Cancel = True
Me.Combo1 SetFocus
Beep
End If
End Sub

HTH

Pieter



Sheryl said:
I tried this and it creates an error and tells me to debug. Is there an
"if"
statement that I could utilize? Something to the effect - If [checkbox1]
=
true then ComboBox1 Is Not Null

I know that's not how to write it, but I'm just learning visual basic and
am
not for sure how to write it.

ruralguy via AccessMonster.com said:
Use the Exit event of the ComboBox and
Cancel = True If Len(Me.ComboBox & "") = 0


--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top