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

Creating a table-level validation rule to compare date fields

19
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 it. We are building a database for a condo rental company and the rental transaction table includes an arrival date and a departure date. We need to write a table-level validation rule that indicates the departure date is seven days after the arrival date. I have been trying to figure out how to write this but I can't find any examples for this type of VR and so I don't know what direction to go. I have found that these VR use And/Or statements but my brain is not seeing how to use these statements for this problem. Can anyone give me an example or lead me to a reference that will show me information on Table-level validation rules that compare date fields?

Thank you
Laura Edmark
Oct 14 '07 #1
6 8113
MMcCarthy
14,534 Expert Mod 8TB
Open the table in Design View and right click anywhere and go to properties.

This should open the table properties window.

In Validation Rule put ...

[departure Date]>=[arrival Date]+7

Change the field names to correspond to your own exactly
Oct 14 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
The rule is basically if you are putting a validation rule on that just involves one field you can put it at field validation level. However, if the rule involves a comparison to another field you need to put it at Table validation level.
Oct 14 '07 #3
Ledmark
19
Thank you so much for your help and direction. I'll give it a try.

Laura


Open the table in Design View and right click anywhere and go to properties.

This should open the table properties window.

In Validation Rule put ...

[departure Date]>=[arrival Date]+7

Change the field names to correspond to your own exactly
Oct 15 '07 #4
Ledmark
19
OK - I went into the table properties and entered the validation rule for the dates and then when I went back into the table to test the data nothing happened - it let me enter a rental period of more than seven days and didn't give me the validartion tecxt like it should have - it let me save the entry and everything. Am I missing something?

Thanks
Laura Edmark
Oct 15 '07 #5
MMcCarthy
14,534 Expert Mod 8TB
Open the table in Design View and right click anywhere and go to properties.

This should open the table properties window.

In Validation Rule put ...

[departure Date]>=[arrival Date]+7

Change the field names to correspond to your own exactly
Sorry I misread your original post to be greater than 7 days not equal to 7 days. Change the validation rule to exclude the > symbol.

[departure Date]=[arrival Date]+7
Oct 15 '07 #6
Ledmark
19
Thank you for your help :) I tried this before and the same thing happened so I'll try it again and if it does the same thing then I'll ait to see the solution. Again - thanks.
Oct 15 '07 #7

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

Similar topics

4
by: gonzal | last post by:
Hi Dose any body know why a temporary table gets deleted after querying it the first time (using SELECT INTO)? When I run the code bellow I'm getting an error message when open the temp table...
11
by: randi_clausen | last post by:
Using SQL against a DB2 table the 'with' key word is used to dynamically create a temporary table with an SQL statement that is retained for the duration of that SQL statement. What is the...
2
by: David Bradbury | last post by:
I currently have an iframe on a webpage into which users can insert content. They can further customise the text as I've included buttons such as Bold, Italic, Bullet point etc. This is done along...
12
by: enak | last post by:
I have found some code that shows how to convert an html form to Word. The message said to simply put the following in the Page_load: Response.ContentType = "application/ms-word"...
3
by: m3ckon | last post by:
Hi there, I can succesfully create a word doc from my asp.net page, but I have 2 issues I need to resolve in order to use it in my app: 1) Creating a table: I seem unable to create a table,...
4
by: Coleen | last post by:
Hi All :-) Can anyone give me a URL where I can find a good example of code on how to create a temporary SQL table using VB.net? I've checked the Microsoft site at: ...
13
by: Jo | last post by:
Hi. I'm getting the following error when creating a table with 250 columns .. I have tried creating it in a 32K tablespace , still the same issue. Is this a limitation in DB2? I am using DB2...
2
by: astolpho | last post by:
I am using a slightly outdated reference book on J2EE programming. It gives 2 methods of creating a database used in its casestudies. The first is an ANT script that gives the following output: ...
2
by: djpaul | last post by:
Hello, I have this program and when i want to load pictures it crashes at the form.showdialog()....??? Here it goes: Private Sub CmbPath_SelectedIndexChanged(ByVal sender As Object, ByVal e As...
6
by: firefighter17103 | last post by:
Hi All, I am new to MS Access 07, & do not know any VB, on a new business adventure. I am running Office07 on Vista Home Premium. I am in the process of creating a database that in the end I...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.