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

How to convert string name to Database object Table?

P: 1
locationName = networkName + " Locations"

above string name is same as my table names in access. How can I convert above string name to table name so that it can be used in the SQL query?
Dec 19 '07 #1
Share this Question
Share on Google+
1 Reply


puppydogbuddy
Expert 100+
P: 1,923
locationName = networkName + " Locations"

above string name is same as my table names in access. How can I convert above string name to table name so that it can be used in the SQL query?
The following 2 ways might work.
Expand|Select|Wrap|Line Numbers
  1. Dim locationName As String
  2. locationName = CStr(networkName) & "locations"
  3. Select * From "[" & locationName & "]" 
  4. _____________________________________________
  5.  
  6. Dim rsSource As DAO.Recordset
  7. Dim locationName As String
  8.  
  9. locationName = CStr(networkName) & "locations"
  10. Set rsSource = CurrentDb.OpenRecordset(locationName, dbOpenTable)
Dec 24 '07 #2

Post your reply

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