required fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I already asked how to do this but I dont think I was clear enough with what
I need. Basicly I need sers to be required to fill in this field when another
field is updated. Like:

if me.field1 = >0 then me.field2 = required

I know thats probably not correct...can someone help me please. I need a
users to be required to fill in this field only when another field is updated.

Paul
 
In the form's BeforeUpdate event, check Field1 to see if it is >= to 0. If
it is, then check to see if there is an entry in Field2. If there isn't, pop
up a message to advise the user of the problem and Cancel the update.

Example:
If Me.txtField1 >= 0 And IsNull(Me.txtField2) Then
Msgbox "An entry is required in Field2.", vbOkOnly + vbExclamation
Me.txtField2.SetFocus
Cancel = True
Exit Sub
End If
 
Back
Top