Thanks for taking the time to read my question.
I want to use SQL in the TransferSpreadsheet Method, but I can't get it
to work.
I don't know why, because I've done a debug.pring on the same code to
see what the code resolves to and it looks just like the select
statement in the query I based it on.
I want SQL in there so that it can be dynamic. Any table, and any date
field in that table.
Expand|Select|Wrap|Line Numbers
- DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8,
- "SELECT " & Me.cboTableNames & ".*, " & Me.cboTableNames & "." &
- Me.cboDateFields & " " & _
- "FROM " &
- Me.cboTableNames & _
- "WHERE ((("
- & Me.cboTableNames & "." & Me.cboDateFields & ") Between #" &
- Me.txtStartDate & "# And #" & Me.txtEndDate & "#));", Me.txtSaveTo & "\"
- & Me.txtFileName
The error I get is: Error Number 3011, The Microsoft Jet Database Engine
could not find the object 'the sql I wrote goes in here'. Make sure the
object exists and that you spell its name and the path name correctly.
Thanks again for your help.
Brad
*** Sent via Developersdex http://www.developersdex.com ***