Why does my VB code fail?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The Following code generates Run-time Error ‘2427’, which says “You entered an 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
 
Pup said:
The Following code generates Run-time Error '2427', which says "You
entered an 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

I'm not sure why you posted this in .formscoding, when it's a .reports
question, but in the report's Open event, the report's bound controls
haven't yet been loaded with data -- I don't think the control objects
have even been instantiated. Do this in a later event, maybe the Format
event of the Report Header section.
 
Back
Top