2000 loses tables & queries!

simongallop

Registered User.
Local time
Today, 15:51
Joined
Oct 17, 2000
Messages
611
I run a monthly code that appends data to a table, then runs a make table query which manipultaes the data into the right format for export and then loops through by building a query using the QueryDef code to create the site specific exports necessary for Excel. In 97 it works fine. In 2000 when it gets to the export bit it says that the query does not exist. When I look at the DB there are no tables and no queries, yet forms, macros and modules exist. Can anyone explain why? Better still can anyone tell me what to do to rectify the problem.

The code that I use which seems to be causing problems is:

'OUTPUT REPORTS
Set SiteRS = CurrentDb.OpenRecordset("SITE", dbOpenDynaset)
Set qdfOutput = CurrentDb.QueryDefs("Output_Excel")
SiteRS.MoveFirst

'MAKE TABLE TO KEEP LIST OF REPORTS
CurrentDb.TableDefs.Delete "Excel_List"
ListSQL = "CREATE TABLE Excel_List ( FileName Text );"
CurrentDb.Execute ListSQL
Set ListRS = CurrentDb.OpenRecordset("Excel_List", dbOpenDynaset)

Do
SiteNum = SiteRS("SN")
SiteName = SiteRS("SiteName")

'CURRENT FILES
'REMAINDER
OutSQL = "SELECT * FROM Ex_Out INNER JOIN Report_Groups ON Ex_Out.BAG = Report_Groups.bag " & _
"WHERE ((Ex_Out.SN)=" & SiteNum & ") AND (Ex_Out.COSTTYPE) = 'CURR' AND ((Report_Groups.REMAIN)=-1);"
qdfOutput.SQL = OutSQL
FileName = SiteName & "_REMAIN_CURR"

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel5, "Output_Excel", "k:\reports\weekly\spreads\" & FileName & ".xls"
###Crashes at the above line claiming that nothing exists!###

Thanks in advance
 

Users who are viewing this thread

Back
Top Bottom