PC Review


Reply
Thread Tools Rate Thread

Access 2010: Referring to another table in a validation rule

 
 
DC3 DC3 is offline
New Member
Join Date: Aug 2011
Posts: 2
 
      22nd Aug 2011
New to the forums, currently building my third Access database. This one is the first that will actually be used.

I have a Visit table with a DateVS field and a Client table with a EnteredOnCL field. DateVS is date of the visit. EnteredOnCL is a hidden field with default as Date() so I know when the Client was added to our system.

I want to prevent a visit from occurring significantly before the Client was entered, but I also want to give some wiggle room for late data entry. Here was my idea for a validation rule on DateVS:

Quote:
DatePart("yyyy",[DateVS])>=DatePart("yyyy",[EnteredOnCL]) And DatePart("q",[DateVS])>=DatePart("q",[EnteredOnCL])
I was hoping this would require DateVS to be in a quarter equal to or later than EnteredOnCL. But it looks like I can't refer to a field from another table in a validation rule.

Is there any way to do this? Thanks.
 
Reply With Quote
 
 
 
 
DC3 DC3 is offline
New Member
Join Date: Aug 2011
Posts: 2
 
      22nd Aug 2011
I need to do this because I'm separating Visits by New and Returning Clients with a nested query using these expressions:

Quote:
Expr1: IIF(DatePart("q",[DateVS])=DatePart("q",[EnteredOnCL]) AND DatePart("yyyy",[DateVS])=DatePart("yyyy",[EnteredOnCL]), 1, 0)

ReturnClient:IIF(Expr1=0,[ClientID],null)

NewClient:IIF(Expr1=1,[ClientID],null)
If the DateVS is in the same quarter as EnteredOnCL, the Client's visit is classified as new. Different quarters, returning. But this doesn't work if there are visits more than a quarter before the client was entered.
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation Rule in Table Emma Aumack Microsoft Access Form Coding 2 5th Mar 2008 11:10 PM
Validation rule for a table =?Utf-8?B?R2lsbGVzQUJlbGFuZ2Vy?= Microsoft Access 1 31st Mar 2006 11:35 PM
validation rule- only allow if in other table =?Utf-8?B?TW9vbGlpQmV0aA==?= Microsoft Access 1 8th Aug 2005 04:28 PM
Table-validation rule. =?Utf-8?B?Rml0eg==?= Microsoft Access Queries 3 18th Jul 2005 01:51 PM
Table Validation Rule Max Microsoft Access Database Table Design 5 23rd Jan 2004 07:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:01 PM.