run-time error 2427

  • Thread starter Thread starter David Newmarch
  • Start date Start date
D

David Newmarch

I have the following code on the Open event of a report rptInvoice which
opens from a button on a form frmOrders, but when I try to open the invoice
report I get a run-time error 2427 and the debug highlights the line

"If Me.chkIsAgent = True Then"

The value for the IsAgent field - true or false - shows up fine in the
underlying query for rptInvoices. Default value is set in the underlying
table at "false".

Here is my code, and I would be very grateful if anyone can point out to me
what could be wrong with it. My grasp of VBA is slender at the best of times.

Private Sub Report_Open(Cancel As Integer)
'Hide agency controls when the order is not from an agency

If Me.chkIsAgent = True Then
Me.txtOrderForAddress.Visible = True
Me.lblAgentDiscount.Visible = True
Me.txtAgentDiscount.Visible = True
Me.txtAgentDiscountCalc.Visible = True

Else
Me.txtOrderForAddress.Visible = False
Me.lblAgentDiscount.Visible = False
Me.txtAgentDiscount.Visible = False
Me.txtAgentDiscountCalc.Visible = False

End If

End Sub
 
Many thanks Damon.

It works, and I also now grasp the difference between the Load event and the
Open event.

David
 
Back
Top