Validation Rules

misslee1888

New member
Local time
Today, 22:54
Joined
Dec 2, 2002
Messages
98
Is there any to way in which I can restrict the date entered in a date field.

The user should only be allowed to enter the date and time if it is not Monday - Friday. between the hours of 9-5.

Is there a way that this can be restricted?

Thanks
 
If you are entering data using a form put codes behind the Before Update event of the control.

I'm not an expert in writing codes so I cannot tell you how to write the codes now. If you need help post again. If you still get no answer I'll try.

Peter
 
Are you saying that you don't want them to be able to enter a date in this field if the current day/time is M-F, 9-5? Or they're going to be entering a date and time, and the input data can't be a M-F, 9-5?
 
I played around with it presuming the second option. Here's a way to test 2 fields, a date and a time, to see if the input date/time is M-F, 9-5:
Code:
Select Case Weekday(Me.txtDate)
  Case 2 To 6
  If Me.txtTime >= #9:00:00 AM# And Me.txtTime <= #5:00:00 PM# Then
    'the input is M-F, between 9 & 5
  End If
End Select
Now I'm off to bed. :p
 
Thanks for that Paul

I will have a go with that, what I am looking for is a validation rule which will only allow the users to insert a date which is Monday to Friday, between 9 to 5. If they try to insert a value which is not M-F, 9-5. They will get an error message.
 
I had a go at the code, but I need that time and the date to be in the same field. not seperate.
 

Users who are viewing this thread

Back
Top Bottom