Need help with syntax please

jvincent

Registered User.
Local time
Today, 13:45
Joined
Apr 30, 2005
Messages
99
Hi,
in the following code:

Dim dbtmp As DAO.Database
Dim tblObj As DAO.TableDef
Dim rs As DAO.Recordset
Set dbtmp = OpenDatabase("C:\WINDOWS\Bureau\devcli.xls", False, True, "Excel 8.0;")
DoEvents
Set rs = dbtmp.OpenRecordset("select * from [DEVCLI$A1:C10]")

in the last line i would like replace DEVCLI (the Excel sheet name) by a variable to make my program works with any excel file.
What is the syntaxe for that ?
Thanks in advance for help.
VINCENT
 
Vincent,

Haven't worked with excel recordsets, but I would be trying

Code:
Set rs = dbtmp.OpenRecordset("select * from [" & FIELDNAMEHERE & "$A1:C10]")

Brad
 
Thank you BRAD that works perfectly, it's so simple i don't know why i have not tried this syntaxe before.
Have a nice day.
VINCENT
 

Users who are viewing this thread

Back
Top Bottom