How to call Form values in a SQL Query

K0k1man

Registered User.
Local time
Today, 04:55
Joined
May 11, 2007
Messages
18
Hi,

I need to build a query where upon form input a different table gets queried.

SELECT *
FROM ((Forms!DCL!PortDropDown))
WHERE ((Forms!DCL!DestinationList=(Reg_Dest.Destination)));

The "FROM" is my problem. The "WHERE" is working. I am getting a "SYNTAX ERROR IN JOIN OPERATION" error message. Please help.

Thank you:confused:
 
you select from a table not a form. are the values in the drop down listed in a table?
 
Hi and thanks for the help.

The form drop down (PortDropDown) value is the name of the table to be queried
 
I tried making a sample db for you, but i couldnt get it to work correctly. im sure someone else will be of more help than i. good luck
 
You'll have to build the SQL in VBA, as you can't use a form value for the FROM clause. This type of problem often hints at a design problem. I would question why you have tables for each port, rather than 1 table with a field to indicate the port.
 
I see.... I will look into that advice and will also see about SQL in VBA.

thanks
 
Search the forum for Dynamic SQL. I have posted some examples in the past.
 

Users who are viewing this thread

Back
Top Bottom