run-time error 2427

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
 
D

David Newmarch

Many thanks Damon.

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

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top