D
Dan_S
Dear All,
I have a VBA procedure that runs all of the queries of a particular name in
a database, and exports them to an Excel spreadsheet. I'd like to skip the
queries where no results are returned to make the spreadsheets more
manageable by its users.
I can do this with DCount, but the process is very slow. The code I have so
far is as follows:
Public Sub ExportRAEQueries()
Dim dbs As Database, qdf As QueryDef
Set dbs = CurrentDb
For Each qdf In dbs.QueryDefs
If Left(qdf.Name, 7) = "AUD_RAE" Then
If DCount("*", qdf.Name) > 0 Then
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, qdf.Name,
"c:\Reports\RAE Audits.xls", True
End If
End If
Next qdf
Set dbs = Nothing
End Sub
How can I change this code to increase its performance?
Many Thanks!
Dan
I have a VBA procedure that runs all of the queries of a particular name in
a database, and exports them to an Excel spreadsheet. I'd like to skip the
queries where no results are returned to make the spreadsheets more
manageable by its users.
I can do this with DCount, but the process is very slow. The code I have so
far is as follows:
Public Sub ExportRAEQueries()
Dim dbs As Database, qdf As QueryDef
Set dbs = CurrentDb
For Each qdf In dbs.QueryDefs
If Left(qdf.Name, 7) = "AUD_RAE" Then
If DCount("*", qdf.Name) > 0 Then
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, qdf.Name,
"c:\Reports\RAE Audits.xls", True
End If
End If
Next qdf
Set dbs = Nothing
End Sub
How can I change this code to increase its performance?
Many Thanks!
Dan