asingh
06-26-2007, 03:01 PM
Hi,
How do I run a SELECT query in Access-VBA where the table name is supplied dynamically.
I have tried the following line...but it is not working..
DIM rst as ADODB.recordset
Set rst = New ADODB.Recordset
rst.Open "SELECT tbl_name FROM & ' " & tbl_nm & " ' ", CurrentProject.Connection, adOpenStatic
rst.Close
Set rst = Nothing
I get the error "syntax error in from clause"
The column name tbl_name is existent in the table I am trying to query...!
thanks a lot for the help...
regards,
asingh
How do I run a SELECT query in Access-VBA where the table name is supplied dynamically.
I have tried the following line...but it is not working..
DIM rst as ADODB.recordset
Set rst = New ADODB.Recordset
rst.Open "SELECT tbl_name FROM & ' " & tbl_nm & " ' ", CurrentProject.Connection, adOpenStatic
rst.Close
Set rst = Nothing
I get the error "syntax error in from clause"
The column name tbl_name is existent in the table I am trying to query...!
thanks a lot for the help...
regards,
asingh