By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,454 Members | 3,133 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,454 IT Pros & Developers. It's quick & easy.

Using user input in a query to select different table

P: 42
Hi

have this query which works ok now :

Expand|Select|Wrap|Line Numbers
  1.  SELECT *
  2. FROM [Table]
  3. WHERE (((Table.published) Like '*'&[Forms]![Search_Records]![Combo7]& '*' And (Table.published) Like '*'&[Forms]![Search_Records]![Combo9]& '*' and  (Table.address) Like '*'&[Forms]![Search_Records]![txtcity]& '*'  )); 
and instead of using the default table which in this case is [Table] , i want to let the user to input which table the query to search on , and what i did is this

Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM [Forms]![Search_Records]![txttable]
  3. WHERE ((([Forms]![Search_Records]![txttable].published) Like '*'&[Forms]![Search_Records]![Combo7]& '*'
  4. And ([Forms]![Search_Records]![txttable].published) Like '*'&[Forms]![Search_Records]![Combo9]& '*' 
  5. and  ([Forms]![Search_Records]![txttable].address) Like '*'&[Forms]![Search_Records]![txtcity]& '*'  )); 
but for some reason is not working.
Can anyone tell me what am i doing wrong ??

Thanks.
May 18 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

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