I having to export records to an Excel file. This I have working well. Except when exporting the records I end up with a number on empty Excel sheets, as there are no records to export.
My apologies for being dim, the code that I’m using is pretty simple, I just can not see how to not export to Excel file when no records exist. I know that this staring me right in the face.
Here is my code, would someone point me in the direction of a solution?
Private Sub btnRunAll_Click() Dim IndexNum As Integer For IndexNum = 0 To Me.cboRoutes.ListCount - 1 'Select Routes and Run Query Me.cboRoutes.Value = Me.cboRoutes.ItemData(IndexNum) DoCmd.RunMacro "mcrMapPointRouteExport" Next IndexNum MsgBox "Your file can be found here:"