Output query to Excel using query in VB instead of actually query
Posted on 2008-06-12
I have the following code:
Dim sSQL As String
sSQL = "SELECT tblROP_ByWeek.* FROM tblROP_ByWeek WHERE (((tblROP_ByWeek.MonDate)=Forms!frmROP!StartDate)) ORDER BY tblROP_ByWeek.ClientName, tblROP_ByWeek.NewspaperName; "
DoCmd.OutputTo acOutputQuery, "sSQL", acFormatXLS, "C:\WINDOWS\Temp\ROPWeeklyData.xls", True
I want to output this query to Excel. When I run it, I get error - can't find 'sSQL'. What do I have to chage to get this to work?