getting table name from a text box query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have succsessfully made a datebase connection using DAO. now I want to get
data from a specific table of database using table name written in combobox.
what will be a quaery for retriving table name from a combobox or textbox.

example:

rs=db.openrecordset("select * from combobox1.text)"
but its not working
 
Probably because you are not referencing the control explicitly. That is
the ComboBox or TextBox, if these are on the worksheet refer to them as

Sheets("SheetName").ComboBox1.Value

or UserForm

UserForm1.ComboBox1.Value

I personally would store the control value to variable and refer to that,
also trim the value in case there are spurious spaces in the string!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top