I have a button that runs run two queries at the same time:
1st - CollectionQueryReport - generates and prints a report
2nd - NicelabeQuery - generates a table that is exported to a network drive
Both queries use the same parameter, when the user clicks on the button access asks for the parameter 6 times, and this runs the first query. but then access asks the user for the parameter again to run the second query.
is there a way to prevent access from asking for the parameter twice?
Is there a way to prevent error MS access error 2510 window if the user clicks cancel on the Enter Parament Value window?
Code:
Private Sub CollectionReport_Click()
LResponse = MsgBox("Are You Ready To Print Collection and Labels Reports?", vbYesNo, "Run Report?")
If LResponse = vbYes Then
DoCmd.OpenReport "CollectionQueryReport", acViewNormal
DoCmd.OutputTo acOutputQuery, "NiceLabelQuery", acFormatXLSX, "\\ServerName\Shared\Folder\Database\Tablet 1\NiceLabels.xlsx"
Else
Cancel = True
End If
End Sub