Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Combo Box Table Question

Status
Not open for further replies.

Igawa29

MIS
Jan 28, 2010
99
US
OK so basically what I am looking to do is to have a drop down (Combo Box) with all my tables listed. I want to have a query basically pull all the table's data depending on which table the user selects.

I just wanted to see why this code doesn't work and if anyone had suggestions.

Code:
SELECT *
FROM [FORMS]![Report]![Report];
 
Code:
"SELECT *
FROM " & [FORMS]![Report]![Report];
i dont know from where you running this code but it will be something like the above
 
hmm.

I am getting an error "Invalid SQL statement; expected 'DELETE','INSERT','PROCEDURE','SELECT', or 'UPDATE'.
 
I am just creating a blank Query using SQL. Not bringing any tables in or anything.
 
i do not think that you can do this from a blank query

what you can do is create a query and put in any table name

and in code on the form

Code:
dim mydb as database 
set mydb = currentdb
mydb.querydefs("queryname").sql="SELECT * FROM " & me.report
docmd.openquery "queryname"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top