Why does my VB code fail?

P

Pup

The Following code generates Run-time Error ‘2427’, which says “You entered and expression that has no value.†The control on the report I have generated is named Received and it is a yes / no check box. What is my error?

Private Sub Report_Open(Cancel As Integer)
On Error GoTo Err_Report_Open

If Received.Value = True Then
Line99.Visible = True
Line100.Visible = True
Box97.Visible = True
End If


Exit_Report_Open:
Exit Sub

Err_Report_Open:
MsgBox Err.Description
Resume Exit_Report_Open

End Sub
 
K

Ken Snell

The OnOpen event is likely too early to run code that uses values of
controls; they usually haven't been created by the report yet.

Use the OnFormat event of the desired section.

--
Ken Snell
<MS ACCESS MVP>

Pup said:
The Following code generates Run-time Error '2427', which says "You
entered and expression that has no value." The control on the report I have
generated is named Received and it is a yes / no check box. What is my
error?
 

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