473,395 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Validation Rule for Date (1/1/yyyy or 12/1/yyyy)

Rob
How can I create a validation rule for only allowing
two specific dates but with variable years:

1/1/yyyy or 12/1/yyyy

so only the dates 1/1/2004 or 1/1/1999
or 12/1/2001 etc.
I tried the yyyy but it won't let me do it

You can put it in the Mask property but only one date?

Thanks

Rob

Nov 13 '05 #1
1 1831
If you're using a form for data entry, then
use the Before Update event (air code):

If Format(Me.YourDate,'mmdd')<>'0101' And _
Format(Me.YourDate,'mmdd')<>'1201' Then
Msgbox 'Date Must Be 1/1 or 12/1'
Cancel = True
Exit Sub
Endif

Fred Zuckerman
"Rob" <ro**@physics.umd.edu> wrote in message
news:41***************@physics.umd.edu...
How can I create a validation rule for only allowing
two specific dates but with variable years:

1/1/yyyy or 12/1/yyyy

so only the dates 1/1/2004 or 1/1/1999
or 12/1/2001 etc.
I tried the yyyy but it won't let me do it

You can put it in the Mask property but only one date?

Thanks

Rob

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Joey P | last post by:
Hi all, I am doing a project for university whereby i have to implement a simple database related to a frozen foods company. I am having some trouble though creating a validation rule for one...
0
by: Steve V | last post by:
I'm using Access 2000 to build a budgeting/tracking database. Can I make a validation rule (using VBA) that checks the data as if the record has already been added? I've got 5 tables (only the...
2
by: Ant | last post by:
I am trying to create a validation rule in the DOB field of a table to ensure the person is 16 years of age or older, can any one help with this? Thanks
3
by: BrianB830 | last post by:
Hello all, I have a quick question regarding an MS Access database I'm creating. In the entity "ORDER", I have the attributes "Order Date" and "Delivery Date". I need to create a validation...
4
by: Anansie | last post by:
Hello! I have a problem with this table PRODUCTS, it has the following fields: -Product id: Number, single, primary key -Status: validation rule with the following restrictions: in stock,...
10
by: gweasel | last post by:
What is the best way to apply a Validation Rule - or rather, where is the best place to put it? Is there an advantage to putting it on the field in the table vs setting the validation rule on the...
3
by: jasons4u2 | last post by:
i have two fields PROJECT START DATE and PROJECT END DATE. now i want to creat a validation rule so that the Project End Date will be greater than the Project Start Date. Can any one please help...
2
by: SKamholtz | last post by:
I have a field for which I need the data entered to either be in the form of a date, OR to be "N/A". How can I write a validation rule (or is there another option?) to allow for either of these? ...
6
by: Ledmark | last post by:
Hello - I am in a class for Access 2007 Database apllication design and we are covering types of Validation rules. We have a problem that I'm trying to solve but have no idea how to go about writing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.