473,387 Members | 1,549 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,387 software developers and data experts.

how could i create validation rule for more than two fields (date) in access table

I created a access table in which the date fields are like that. DateofBirth, DateofMuster, DateofAppointment and DaeofJoining. Here, the conditions are like that dateofbirth should not be after today, so I put the validation rule in concerned field's general part as >=date(). The dateofMuster should not be before dateofBirth, DateofAppointment should not after DateofJoining. For this how could I enter the validation rule in their respective field VR.
Sep 7 '14 #1
6 2755
GKJR
108 64KB
First off I think you need to change the criteria for DateofBirth to <Date() [instead of >=Date()].

The other fields cannot be validated by values you are entering into fields of the same record (not at the table level that is). The reason for this is that the record hasn't been committed while you are entering the field values. The field values technically don't exist until you exit the record and it gets committed, so there is nothing for the program to compare to.

You may be able to perform your data validation at the form level by creating rules for your controls based on other controls. You could also use VBA to validate your control values on the form before the record is committed.
Sep 7 '14 #2
NeoPa
32,556 Expert Mod 16PB
Good advice, yet not fully correct.

When in Design View of a table you can select to view Table Properties (Alt-Enter toggles between hiding and viewing the window). There is a Validation Rule in there that allows specifying how fields within a record can relate to each other.
Sep 7 '14 #3
zmbd
5,501 Expert Mod 4TB
you don't mention which version of access
Sep 7 '14 #4
NeoPa
32,556 Expert Mod 16PB
I don't think it matters in this case Z. The solution is the same in all versions I tested on (2003 - 3010) and I know it's the same for earlier versions.
Sep 7 '14 #5
zmbd
5,501 Expert Mod 4TB
ACC 2010 has data/table level macros, an after_update event could be set at the table level, think SQL-Trigger, that certainly would work and I believe, but have not tried, that the before change event would work too: Validating User Input With the Before Change Data Macro Event in Access 2010

I'm certain this can be used with a new record:
Before Change Macro Event Office 2010

Hence my request for version as there may be another option (^_^) (not sure of scalability to MYSQL or SQL-Server... but that may not be an issue).

As much as I dislike macros... for sharepoint published I'm having to relearn the macro language. :YUCK:
Sep 8 '14 #6
NeoPa
32,556 Expert Mod 16PB
Fair point. Not sure why you'd be wanting to look at triggers or macros when a straightforward table Valdation Rule is available mind you.
Sep 8 '14 #7

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

Similar topics

4
by: Fiala | last post by:
Table A +--------+-----------+ | A-num | text | | 1 | | | 2 | | | 3 | | | 4 | | | 5 | | +--------+-----------+
2
by: Francisco | last post by:
Hello: i want to know how to delete inner spaces between words of a field in a access table? For example, i need to convert a text field like "one two etc" in "one two etc" The...
3
by: Jan Szymczuk | last post by:
I am trying to create a query that will show me who is phoning who in an organisation from available Telephone Billing information. I am creating a MSAccess 2000 database with a few few tables, two...
1
by: uarana | last post by:
Hi All, I've been working with Acess for a little while now but have never had to do a thing of such sort. Any help would be appreciate. Thanks Problem: A report is sent to users to fill...
2
by: knittingdoc | last post by:
How do I create a validation rule for a date which is all numbers? Example: 12-02-06 How do I make a rule to make sure the month field is >0 and is equal to or less than 12? Likewise with the...
15
by: terbolee | last post by:
I have two tables: Organisations & Invoices. I have a form called Invoices that is used to enter data into the invoices Table. When entering data, I'd like to be able to type into the field, and...
3
by: ago | last post by:
Hi, I have an access query that finds the rows that have certain parameters common among them eg : Username How is it possible to highlight the matches or display only the matches. TBL:...
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...
1
by: cronk005 | last post by:
I am fairly new to Database creation and have devised a nice database which does what I am hoping to do. Though I am sure there is an easier way of accomplishing many of the tasks I have done, as I...
17
by: redman08 | last post by:
I am writing some VBA to create an Excel pivot table in a new worksheet using an existing local table. Because of volumes, I don't want to store the original data (on another sheet and hide it)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.