Help Needed

  • Thread starter Thread starter KDa
  • Start date Start date
K

KDa

Guest
I have a table in Access with three fields: Booking Type, Date of Booking and Date of Event.

I have in the Booking Type field, a lookup consisting of "Regular" and "Occasional".

In either the Date of Booking or Date of Event fields, I'm not sure yet, I plan to have a validation rule.

This validation rule, however, is only need when the Booking Type is "Occasional".

Is there any way that I could have it so the validation is present/needed when the Booking Type is occasional, and not present/needed when the Booking Type is regular.

Please bear in mind I am fairly new to Access

Many Thanks
 
Here are a couple of suggestions:
1) Don't use Lookup Fields. They obscure the real field value and just confuse the programmer.
2) Do most, if not all of your validation in the entry form rather than at the table level.
 
KDa, you could on the BeforeUpdate_() event , of whatever field you choose, to have the Validation rule, use a nested, "If Then" statement.

Private Sub Date_Of_Boooking_BeforeUpdate (Cancel As Integer)
If Me.Booking_Type = "Occasional" Then
If Date_Of_Boooking <> ...Validation Rule... Then
MsgBox "Wrong Day of Month" & vbCrLf & _
"Date Must be a valid Weekday", vbOkOnly + vbExclamation
Cancel = true
End If
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom