473,785 Members | 2,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating a table-level validation rule to compare date fields

19 New Member
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 8161
MMcCarthy
14,534 Recognized Expert Moderator MVP
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 Recognized Expert Moderator MVP
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 New Member
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 New Member
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 Recognized Expert Moderator MVP
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 New Member
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
49448
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 for the second time. Error Type: Microsoft OLE DB Provider for SQL Server (0x80040E37) Invalid object name '#testtable'.
11
16299
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 equivalent to the SQL 'with' using TSQL? If there is not one, what is the TSQL solution to creating a temporary table that is associated with an SQL statement? Examples would be appreciated. Thank you!!
2
2986
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 the lines of <td><div class="cbtn" onClick="cmdExec('bold',idContent)" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="1" vspace=1 align=absmiddle...
12
4169
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" Response.AddHeader("content-disposition", "inline; filename=BP_CaseStatus.doc") Now all I should have to do is create the page just like I would if I were going to display it in the browser.
3
4236
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, I'm uing the coe below, but I'm unsure as to what the Range parameter should be for oWordDoc.Content.Tables.Add ???
4
24208
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: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/createdb/cm_8_des_04_8jtx.asp which is okay at explaining the process but gives me absolutely no code examples. Unfortunately, I am one of those programmers that can read and
13
9909
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 v8.2 FP 9a. SQL0670N The row length of the table exceeded a limit of "32677" bytes. (Table space "".) SQLSTATE=54010
2
3982
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: D:\original\CaseStudy-2-5\CaseStudy\Day02\exercise>asant database Buildfile: build.xml env-user: prop-user: set-user:
2
1550
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 System.EventArgs) Handles CmbPath.SelectedIndexChanged Dim Table As DataTable Dim i As Integer Dim ThumbSize As Integer = 160
6
8011
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 will be able to create quotes, bill out customers for security services, cctv products and installs,create purchase orders to my distributors being that I keep no inventory on hand, and track payments such as deposits on equipment. What I need help...
0
9646
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10350
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10097
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8983
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.