Hi all,
Please could you advise on how to stop below code if no data
Please could you advise on how to stop below code if no data
Private Sub Submit_Click()
Dim StrFileName As String
Dim StrSaveFile As String
StrFileName = strGetFileFolderName("Sales Invoice" & " - Customer -" & " " & Forms![Sales_Invoice]![CustomerName], 2, "Excel")
If Len(StrFileName & "") < 1 Then
StrFileName = Application.CurrentProject.Path & "\Sales Invoice" & Format(Date, "yyyymmdd") & ".xls"
End If
DoCmd.SetWarnings False
DoCmd.OpenQuery "Update Document Sequence - SI"
DoCmd.OpenQuery "Update Transactions- Commercial SI"
DoCmd.OpenQuery "Update Transactions - Commercial - Invoice Number"
DoCmd.OpenQuery "Update Payments from Invoice"
DoCmd.OutputTo acReport, ("Sales Invoice"), acFormatPDF, ("Sales Invoice" & " - Customer Name -" & " " & Forms![Sales_Invoice]![CustomerName] & ".PDF")
Submit_Click_Exit:
DoCmd.Close , ""
DoCmd.OpenForm "Sales_Invoice"
DoCmd.SetWarnings True
Exit Sub
Submit_Click_Err:
MsgBox Error$
Resume Submit_Click_Exit
End Sub