Making a field Required (1 Viewer)

Peter Paul

Registered User.
Local time
Today, 03:53
Joined
Jan 1, 2000
Messages
82
I am trying to make a field required, only if certain criteria is met in another field.

If ExceptionalClearance < 6 then ExceptionalClearanceDate Is Required?

Thanks for any help,
Peter Paul
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 22:53
Joined
Feb 19, 2002
Messages
43,368
Put the code in the BeforeUpdate event of the FORM.

If Me.ExceptionalClearance < 6 Then
If IsNull(Me.ExceptionalClearanceDate) Then
msgbox "Your message", vbOKOnly
Me.ExceptionalClearanceDate.SetFocus = True
Cancel = True
End If
End If
 

Peter Paul

Registered User.
Local time
Today, 03:53
Joined
Jan 1, 2000
Messages
82
Pat, Thank you that worked well. Except I had to delete the = True to get it to work. When I ran the debug it kept hanging there.

Let me follow this up with two questions. What does Me stand for? I looked in the book I have and it does not mention it, though I have seen and used it previously.

Also, I need to further code for this possibility. That someone chooses option 3 for Incident Status, as in the previous example, but then chooses option 6 for ExceptionalClearance, which is Not Applicable. The two are mutually exclusive. I have been playing with the code, and tried this on the BeforeUpdate event for the form:

If Me.IncidentStatus = 3 And Me.ExceptionalClearance = 6 Then
MsgBox "You have indicated that the Incident Status was Cleared Exceptionally but have not designated a type of exception. Please correct this"
Me.ExceptionalClearance.SetFocus

End If

To no avail. I really appreaciate your help. I am trying to get a handle on this so I don't have to ask so many questions.

Thanks,
Peter Paul


[This message has been edited by Peter Paul (edited 03-28-2001).]
 

Users who are viewing this thread

Top Bottom