G
Gornza
Hi, the following is code I have that , when the option is chosen, the user
will be prompted about what invoice # they want to display. Also if nothing
is entered, they will be kicked out ot the main screen.
What I am wondering what to code is how to handle when an Invoice # is
entered but that number does not exist (I want them to get a message box
saying such): Here is my code so far:
******
Private Sub CMDpreviewInvoiceReport_Click()
'On Error GoTo CMDpreviewInvoiceReport_Click_Err
'note, below GRPIO is the name of the Form containing the option buttons.
On Error GoTo CMDpreviewInvoiceReport_Numb_Err
' Select by Invoice #
If (GRPIO = 1) Then
'prompt user for invoice number....
DoCmd.OpenReport "INVOICE REPORT", acViewPreview, "", "[INVOICE QUERY]
..[Invoice Number]=[What Invoice Number?]", acNormal
'If user hits the "cancel" button they will be brough back to Main
Menu Screen
End If
DoCmd.Maximize
If (GRPIO = 2) Then
' Select by Company
DoCmd.OpenReport "INVOICE REPORT", acViewPreview, "", "[INVOICE QUERY]
..[Company]=[What Company?]", acNormal
End If
DoCmd.Maximize
If (GRPIO = 3) Then
' Select ALL Invoices
DoCmd.OpenReport "INVOICE REPORT", acViewPreview, "", "", acNormal
End If
DoCmd.Maximize
Exit Sub
CMDpreviewInvoiceReport_Numb_Err:
Select Case Err.Number
Case 2501 ' The OutputTo action was cancelled
Resume CMDpreviewInvoiceReport_Numb_Err 'allows rest of code to process
please don't show Dave the 2501 error access
End Select
End Sub
will be prompted about what invoice # they want to display. Also if nothing
is entered, they will be kicked out ot the main screen.
What I am wondering what to code is how to handle when an Invoice # is
entered but that number does not exist (I want them to get a message box
saying such): Here is my code so far:
******
Private Sub CMDpreviewInvoiceReport_Click()
'On Error GoTo CMDpreviewInvoiceReport_Click_Err
'note, below GRPIO is the name of the Form containing the option buttons.
On Error GoTo CMDpreviewInvoiceReport_Numb_Err
' Select by Invoice #
If (GRPIO = 1) Then
'prompt user for invoice number....
DoCmd.OpenReport "INVOICE REPORT", acViewPreview, "", "[INVOICE QUERY]
..[Invoice Number]=[What Invoice Number?]", acNormal
'If user hits the "cancel" button they will be brough back to Main
Menu Screen
End If
DoCmd.Maximize
If (GRPIO = 2) Then
' Select by Company
DoCmd.OpenReport "INVOICE REPORT", acViewPreview, "", "[INVOICE QUERY]
..[Company]=[What Company?]", acNormal
End If
DoCmd.Maximize
If (GRPIO = 3) Then
' Select ALL Invoices
DoCmd.OpenReport "INVOICE REPORT", acViewPreview, "", "", acNormal
End If
DoCmd.Maximize
Exit Sub
CMDpreviewInvoiceReport_Numb_Err:
Select Case Err.Number
Case 2501 ' The OutputTo action was cancelled
Resume CMDpreviewInvoiceReport_Numb_Err 'allows rest of code to process
please don't show Dave the 2501 error access
End Select
End Sub