Date validation

Learning123

New member
Local time
Today, 04:26
Joined
Jan 4, 2009
Messages
9
Hi,

I am creating a bookings database. I need to stop people from making a booking on Mondays.

Does anyone know how to make a validation rule stopping people from booking on Mondays in the Date field?

I am thinking that I need to have a Day field, where the Weekday number (1,2,3, etc) is updated according to the date entered in the Date field (and then validation on that field can be entered to stop the number "2" being entered) - but I have no idea how to do this.

Would be grateful for any help as time is running fast! Thanks
 
In the control's Before Update event you can put

Code:
If Format(Me.YourControlNameHere.Text,"dddd") = "Monday" Then
    MsgBox "You cannot select a Monday", vbInformation, "Validation Error"
    Cancel = True
End If
 
Thanks - but I can't seem to get that to work - do I use this in the Date field, where the format is general (dd/mm/yyyy), or do I need to change something to make this work?
 
:) Thanks - sorry I wasn't being clear enough, I did understand that - but it's working now anyway...I made a mistake in the expression before.

Thanks again!
 

Users who are viewing this thread

Back
Top Bottom