Click here to Skip to main content
15,885,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello ,
im looking for a way in Access to limit date, for example if i have a employee birthday date field
i dont want to be able to enter a date that is passed today.

For example i couldn't enter 1/1/2020 for a birth dates.

Thanks for the help!
Posted
Comments
[no name] 8-May-14 9:06am    
"a way in Access", the first question is why are you allowing users to enter data directly into your database as your "question" seems to indicate? If you are actually not allowing this, then what code have you written to validate the data before you insert it into your database? What is the problem that you have with your code?

1 solution

If you are using Access without any frontend (not sure that is a good idea) then you can add a validation rule to the column

1. Go to the Table Design view (for that table)
2. Click on the column that you want to restrict
3. If it is not Data Type = Date/Time then change it to be so
4. in the bottom pane find "Validation Rule"
6. Type in
<Now()
 
Share this answer
 
Comments
Daniel Mashukov 8-May-14 9:21am    
Yes that what i was looking for! thanks!!!
im programming a database application in C# and Access so that's why i need that.
CHill60 8-May-14 9:30am    
Personally I would prefer to do the validation in the C# layer ("business logic") and just leave the database as the storage medium. That way I don't have to replicate the validation if I decide to upgrade or migrate the database to another platform.
Daniel Mashukov 10-May-14 6:09am    
Ok i will try to do that in the future! thanks.
thatraja 8-May-14 9:22am    
5!
CHill60 8-May-14 9:29am    
Thank you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900