Query on table with a lookup
From: Jen (jmiller_at_wbhq.com)
Date: 04/27/04
- Next message: Elizabeth: "Sorting by Month problems with Combobox"
- Previous message: Somayaji: "RE: Can't join on memo or ole object"
- Next in thread: Somayaji: "RE: Query on table with a lookup"
- Reply: Somayaji: "RE: Query on table with a lookup"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 27 Apr 2004 10:14:22 -0700
I created a table with a lookup field to another table.
I've got a module in which I am using a SQL statement
based on the table with the lookup. For example:
sSQL = "Select * From CorporateExtVMX where Dept = '" &
Dpt & "'"
Dept is the field that is the lookup.
When running this code, I get the error message that a
parameter is blank. So I took this bit of code and
created a Query with it. I got a popup box to fill in
Dept.
Now, using the the Query wizard, I was able to create a
Query and the where clause in the SQL ended up
being "where Departmet = 'ACCOUNTING'" Note that this
time Department is spelled out. Department is the field
that is being looked up in the Dept table. But in my
CorporateVMXExt table, the field is Dept.
I apologize if I'm confusing anyone. :)
Okay, so I copied the Query SQL and posted it in the
Module SQL, so now it is this:
sSQL = "Select * From CorporateExtVMX where Department
= '" & Dpt & "'"
And after that I was getting the error message that
Department is not a field in the table. And it's not!
It's a field in the lookup table.
I guess my question is, how am I supposed to write a SQL
query on a table in which one field is looking up a table
from another table? This is driving me nuts!
Thanks,
Jennifer
- Next message: Elizabeth: "Sorting by Month problems with Combobox"
- Previous message: Somayaji: "RE: Can't join on memo or ole object"
- Next in thread: Somayaji: "RE: Query on table with a lookup"
- Reply: Somayaji: "RE: Query on table with a lookup"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|