Check for Data - Need soon if possible.

  • Thread starter Thread starter Jani
  • Start date Start date
J

Jani

Another issue today... How do I code this type of thing... Two fields, first
field one makes a text selection from a list; second field, one would fill in
a number (this field defaults to 0). I want to make sure that someone does
not fill in a number >0 in field 2 if they have not made a selection in field
1. There are about 18 of these fields that need to be coded.

I hope this makes sense and appreciate any help someone can give me. Needing
to get this done by this afternoon so hope there's one of you fantastic
knowledgeable people available. Jani
 
Jani

Are you saying that you want this form to check after Field2 is changed and,
if there's a value other than 0, check to see if an item was selected in
Field1?

If so, you could use the BeforeUpdate event on Field2 to check for a value
in Field1 and cancel the update (along with a message to the user).

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Jani,
Given examples of controls... lstText (your list) and SomeNum (your
numeric text control)

Use the AfterUpdate event of lstText to...

Private Sub lstText_AfterUpdate()
SomeNum.Enabled = Not IsNull(lstText)
End Sub

Also, you'll need the same code in the form's OnCurrent event...

Private Sub Form_Current()
SomeNum.Enabled = Not IsNull(lstText)
End Sub

--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Back
Top