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
3 2306
This should give any records where Hotel_Exp is greater than the Max allowed: -
SELECT Hotel_Exp FROM Input
-
WHERE Hotel_Exp > DLookup("Max","Constraints","[Field]='Hotel_Exp');
-
Then just substitute Airfare for Hotel_Exp and run again.
Mary
This should give any records where Hotel_Exp is greater than the Max allowed: -
SELECT Hotel_Exp FROM Input
-
WHERE Hotel_Exp > DLookup("Max","Constraints","[Field]='Hotel_Exp');
-
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'")));
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. -
UPDATE [Staging Table] SET [Staging Table].Error = [Error] & "1001 ,"
-
WHERE ((([Staging Table].Spk_Fee) > DLookUp("[Value_Max]","[Constraints Table]","[Field]= 'Spk_Fee'")));
-
Sign in to post your reply or Sign up for a free account.
Similar topics
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
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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...
| |