Hi All,
I am getting an Object invalid or no longer set error in below code
Could you please advise
I am getting an Object invalid or no longer set error in below code
Could you please advise
Private Sub ExcelNotIssued_Click()
On Error GoTo ExcelNotIssued_Click_Err
Dim StrFileName As String
Dim StrQryName As String
Dim StrSaveFile As String
StrFileName = strGetFileFolderName("Spares for Orders (Received, Not Issued)" & " - Registration -" & " " & Forms![CS Orders Detail - Main]![RegCBO], 2, "Excel")
'Debug.Print StrFileName
StrQryName = "Spares for Orders - Received"
If Len(StrFileName & "") < 1 Then
StrFileName = Application.CurrentProject.Path & "\Spares for Orders (Received, Not Issued)" & Format(Date, "yyyymmdd") & ".xls"
End If
Debug.Print "My File is:" & StrFileName
DoCmd.TransferSpreadsheet acExport, 10, StrQryName, StrFileName, True, , True
'DoCmd.OutputTo acOutputQuery, "Spares for Orders - Received", "Excel97-Excel2003Workbook(*.xls)", "Spares for Orders (Received, Not Issued)" & " - Registration -" & " " & Forms![CS Orders Detail - Main]![RegCBO] & ".xls", True, "", , acExportQualityPrint
ExcelNotIssued_Click_Exit:
Exit Sub
ExcelNotIssued_Click_Err:
MsgBox Error$
Resume ExcelNotIssued_Click_Exit
End Sub