Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Validation Rule???

Status
Not open for further replies.

quest4

Technical User
Aug 27, 2001
735
US
I have four text boxes, with a Date/Time-short format. I use a validation rule to make sure that we don't accidently ent er to many vacation weeks. It works fine except if you accidently enter a date in a texxt box you shouldn't you get a warning message and a beep, then it banks out the date. This is fine except you can't leave the text box til you enter something, and of course everything will cause an error. In the table the field is marked as Not Required, if that is important. Is there any way to stop locking the percon in that box? Thanks in advance.
 
Hi!

I've not seen your code, but I am guessing that you validating in the BeforeUpdate event procedure of the text box(Since that is the procedure you should be using). Do you, after blanking out the date set Cancel = -1. If you are, try getting rid of that line and Access should let the user continue.

hth
Jeff Bridgham
 
Acually I am using the tex box's property sheet, Data tab in the Validation Rule, I entered this line of code:
(Year(Date())=Year([DateVacation1]))
And ([NumberVacationWeeks]=1
Or [NumberVacationWeeks]=2
Or [NumberVacationWeeks]=3
Or [NumberVacationWeeks]=4)
It does a great job of blocking wrong data going in, but after blanking out the bad entry you stay there especially if you are entering one too many vacation weeks. The wrong year I can change and move on OK. I'm just not sure who to tell it to release me. Any sugestions? Thanks you very much for your response.
 
Hi!

Didn't think of using the validation rules! X-)

Try adding Or [DateVacation1] = "".

hth
Jeff Bridgham
 
No go. I added that right at the end and still locked me out, maybe I should try the Before Update event and see if that does anything. I am not a VB expert but I will try anything once. Thanks again for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top