472,958 Members | 2,303 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Need help setting a validation rule. Microsoft Access

I need help setting a validation rule to accept the values 2021 or 2022 or 2023 (in that order) only.
Apr 15 '22 #1
2 10836
443 Expert Mod 256MB
Easy enough to set the validation rule: Between 2021 And 2023
However, I'm unclear what you mean by 'in that order'
The rule just checks if the entered value is valid or not.

If you really want to show a range of valid entries, you could setup a table level lookup field using a combo with a value list for those years in that order. However, table level lookups are definitely not something I would ever recommend.
Apr 15 '22 #2
5,501 Expert Mod 4TB
If you really want to show a range of valid entries, you could setup a table level lookup field using a combo with a value list for those years in that order. However, table level lookups are definitely not something I would ever recommend.
Ideally, your users should NEVER work directly with your tables, all data entry should be done thru the user-forms. With that said, I really wouldn't do a table level lookup combo box - can lead to some real issues down the line.

Table level validation is a completely different beast and is something I do quite regularly, using a limit such as isladogs has suggested; provided, that one is sure that there may not be a need in the future to change the table level validation. Would you need to add "2024" at some point?

So the solution Either do this in the query or in the user form.

I've attached a very simple database to illustrate the point.
Normally I would select one of the forms to open on startup; however, I wanted you to be able to see each of the options.
I've put the numbers in the queries and the tbl_years in the order given, however, you can reorder these as needed with with a sort one the tbl_year in the row source or by changing the order in the static list... etc... most flexible either way.
Attached Files
File Type: zip _SimpleDatabase.zip (22.0 KB, 17 views)
Apr 16 '22 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Mathew Hill | last post by:
I am a beginner to the more technical aspects of Microsoft Access (2000) and was wondering if any one can help? I have a field in a table called: ADMIN NUMBER This field should have 4...
by: Chuck | last post by:
A97. A database has a table: tblA which has a single text field, B. It is a primary field, indexed and no duplicates. It is used as a lookup for table tblC. A form based on tblA is used to add...
by: Pam Ammond | last post by:
I need to use Microsoft Access Automation within a Visual Studio 2003 program written in C# for Windows Forms. When a button is clicked in my VS.NET program, I want it to run a Microsoft Access...
by: michael.meenan | last post by:
I'm trying to limit the number of records that can have a checkbox clicked. I created a query that counts the number of records with that checkbox clicked and tried to make a form validation...
by: ckpoll2 | last post by:
Hello, I have a validation rule in a text box on a form. The rule is that if Combo12 starts with "Credit Hours -*" than only allow numbers less than or equal to 2 in there. Any number of words...
by: Amers01 | last post by:
Dear Can some one tell how can i put a validation rule like CITddmmyy0001 basically I am preparing a database for my video shop and want that id to be like this Actually CIT my compny nick...
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...
by: alakazamm | last post by:
I am building a database on Access 2000 which include a Customer Details table. In this Customer Details table there is a 'Post Code' field which I am required to make an Input Mask to limit the...
by: Harlequin | last post by:
I must start this posing by making the point that I am NOT a VB programmer and I'm something of a Newbie to MS Access. I can program in a number of languages (Java, Javascript, PERL,PHP and TCL) but...
by: JKChan | last post by:
Hi, I'm an A2 ICT student in second year of college right now and I am working on my database project as my coursework. Its about a dance school with 4 tables Student, Class, Teacher and Enrolment. ...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.