I have the following code that opens each file in a directory and is supposed to run each query then export it to a csv. This worked previously with Impromptu 6 on NT. We switched to XP and Impromptu 7 and now the queries open and run, but the results are not saved. An error message saying the operation cannont be performed because the server is busy appears. If I cancel the query as soon as it begins, the empty query results are saved. So I know it's not a problem with the file path - it appears the macro is jumping to the export before there is anything to export, and is not waiting for the query to finish. Any help would be welcomed.
Do While thisFile <> ""
count = count+1
ReportFile = sourceDir + thisFile
Set objImpRep = objImpApp.OpenReport (ReportFile)
FName2$ = destDir + left(thisFile, (len(thisFile) - 4)) + "-" + Mid$(Date$,1,3) + Mid$(Date$,4,3) + _
Mid$(Date$,9,2) + ".csv"
objImpRep.RetrieveAll
objImpRep.exportASCII FName2$
objImpRep.CloseReport
thisFile = dir$
Loop
Do While thisFile <> ""
count = count+1
ReportFile = sourceDir + thisFile
Set objImpRep = objImpApp.OpenReport (ReportFile)
FName2$ = destDir + left(thisFile, (len(thisFile) - 4)) + "-" + Mid$(Date$,1,3) + Mid$(Date$,4,3) + _
Mid$(Date$,9,2) + ".csv"
objImpRep.RetrieveAll
objImpRep.exportASCII FName2$
objImpRep.CloseReport
thisFile = dir$
Loop