473,397 Members | 2,084 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,397 software developers and data experts.

Lookup Validation Table Help!

121 100+
I am not new to Access, but am new to the level of complexity I am now having to get into, so this question may be easy, but I don't even know what to look for to see if it has been posted here before:

I have one table called "Constraints"
and one table called "Input"


Constraints has two columns: Field and Max. Field a list of records with the column names from Input. Max is a constraint value in the second column that the records in Input can't be greater than.

For INstance:

In Input there is a column Hotel_Exp and Airfare. In Constraints there is a Record of Hotel_Exp and Max=1000, Airfare and Max=2000.


I want to run a query to check that Hotel_Exp and Airfare aren't greater than the associated Max values in the Constraints table.


Thanks in advance
Mar 1 '07 #1
3 2306
MMcCarthy
14,534 Expert Mod 8TB
This should give any records where Hotel_Exp is greater than the Max allowed:

Expand|Select|Wrap|Line Numbers
  1. SELECT Hotel_Exp FROM Input
  2. WHERE Hotel_Exp > DLookup("Max","Constraints","[Field]='Hotel_Exp');
  3.  
Then just substitute Airfare for Hotel_Exp and run again.

Mary
Mar 1 '07 #2
JHNielson
121 100+
This should give any records where Hotel_Exp is greater than the Max allowed:

Expand|Select|Wrap|Line Numbers
  1. SELECT Hotel_Exp FROM Input
  2. WHERE Hotel_Exp > DLookup("Max","Constraints","[Field]='Hotel_Exp');
  3.  
Then just substitute Airfare for Hotel_Exp and run again.

Mary


Thanks - It ran fine, except that it ran multiple times for each record in the "Constraints Table". So it is supposed to add an Error Code to an Error Field when Spk_Fee is larger than the Max_value in the "Constraints Table". When I ran it I got the same error code over and over again.

Here's the actual SQL:

UPDATE [Staging Table], [Constraints Table] SET [Staging Table].Error = [Error] & "1001 ,"
WHERE ((([Staging Table].Spk_Fee)>DLookUp("[Value_Max]","[Constraints Table]","[Field]='Spk_Fee'")));
Mar 1 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
Thanks - It ran fine, except that it ran multiple times for each record in the "Constraints Table". So it is supposed to add an Error Code to an Error Field when Spk_Fee is larger than the Max_value in the "Constraints Table". When I ran it I got the same error code over and over again.

Here's the actual SQL:

UPDATE [Staging Table], [Constraints Table] SET [Staging Table].Error = [Error] & "1001 ,"
WHERE ((([Staging Table].Spk_Fee)>DLookUp("[Value_Max]","[Constraints Table]","[Field]='Spk_Fee'")));
You've got a full outer join between [Staging Table] and [Constraints Table]. Remove [Constraints Table] completely from the query as you don't need it.

Expand|Select|Wrap|Line Numbers
  1. UPDATE [Staging Table] SET [Staging Table].Error = [Error] & "1001 ,"
  2. WHERE ((([Staging Table].Spk_Fee) > DLookUp("[Value_Max]","[Constraints Table]","[Field]= 'Spk_Fee'")));
  3.  
Mar 1 '07 #4

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

Similar topics

11
by: John Collyer | last post by:
Hi, In assembly language you can use a lookup table to call functions. 1. Lookup function address in table 2. Call the function Like: CALL FUNCTION
2
by: Eric Linders | last post by:
Hi everyone. :-) Our site gets a ton of traffic on our contact forms, which collect the standard information (name, address, city, state, zip, home phone, etc.) The form validation is done with...
1
by: James E | last post by:
I have a question about best practices of how to deal with lookup data from my C# apps. On a couple of occasions I have come across a problem where I have to automate inserting a record into a...
9
by: Koen | last post by:
Hi all, My application uses a lot of lookup tables. I've splitted the frontend (forms, reports, etc) from the backend (data). The database has around 10 different users. The values in the...
3
by: my-wings | last post by:
I've been reading about how evil Lookup fields in tables are, but I've got to be missing something really basic. I know this subject has been covered before, because I've just spent an hour or two...
3
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
2
by: Dnna | last post by:
I have a table which is bound to an Internet Explorer XML data island. I'm using ASP.NET's client-side validators for an input field in the table. The problem is that if the input fields are in...
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
11
by: Paul H | last post by:
Suppose I have a table called tblPeople and I want a field to illustrate whether each person prefers cats or dogs. I could do it one of three ways. 1. A plain text field Create a text field in...
0
by: =?Utf-8?B?RU1hbm5pbmc=?= | last post by:
(I originally posted this to the data access newsgroup but received no replies) I've got an Access 2003 mdb that I'm converting to VB.Net. I'm having trouble with getting the main data source to...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.