“This Action requires an Object Name argument†Error Message

  • Thread starter Thread starter nytwodees
  • Start date Start date
N

nytwodees

I am trying to print 1 of 7 reports depending upon the selection from my
pop-up Dialog Box Form. This selection would be for the “Number of Paymentsâ€
required. (1 through7).

The Dialog Box Form also has 2 other parameters to select: “Payment Yearâ€
and “Village Name.†All 3 selections are made from drop-down lists. Below
is the code for the event procedure when the “Preview Report†command button
is clicked:


Private Sub PINVSheetsCommand_Click()
On Error GoTo Err_PINVSheetsCommand_Click

DoCmd.Close acForm, frmInvoicingStubsPopUp
If Me.InvoiceListPUPPaymentsNumber = "1" Then
DoCmd.OpenReport "rpt1InvoicingStock", acPreview
DoCmd.Maximize
ElseIf Me.InvoiceListPUPPaymentsNumber = "2" Then
DoCmd.OpenReport "rpt2InvoicingStock", acPreview
DoCmd.Maximize
ElseIf Me.InvoiceListPUPPaymentsNumber = "3" Then
DoCmd.OpenReport "rpt3InvoicingStock", acPreview
DoCmd.Maximize
ElseIf Me.InvoiceListPUPPaymentsNumber = "4" Then
DoCmd.OpenReport "rpt4InvoicingStock", acPreview
DoCmd.Maximize
ElseIf Me.InvoiceListPUPPaymentsNumber = "5" Then
DoCmd.OpenReport "rpt5InvoicingStock", acPreview
DoCmd.Maximize
ElseIf Me.InvoiceListPUPPaymentsNumber = "6" Then
DoCmd.OpenReport "rpt6InvoicingStock", acPreview
DoCmd.Maximize
Else
DoCmd.OpenReport "rpt7InvoicingStock", acPreview
DoCmd.Maximize

End
End If

Exit_PINVSheetsCommand_Click:
Exit Sub

Err_PINVSheetsCommand_Click:
MsgBox Err.Description
Resume Exit_PINVSheetsCommand_Click

End Sub

Each report is linked to 1 of 7 queries. My intention was to pass the
selections from my Dialog Box to the queries. This does not seem to work.

When I make my selections in the Dialog Box and click the Preview Report
command button I receive the following Error Message: “This Action requires
an Object Name argument†and no report is generated.

Does anyone see what I am doing wrong? If so, how can I remedy it! Thanks
in advance.
 
Is frmInvoicingStubsPopUp your current form? You need to close it after the
report runs. If you form is referencing it or the queries are looking for
values in controls, it needs to be open.

Why 7 different versions of the same report?
 
Back
Top