Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run time error 2427 1

Status
Not open for further replies.

cantona

Technical User
May 20, 2001
121
GB
Help!!

I have a report which requires the user to enter two dates. The report then only displays records which fall between the period entered. This part of the report works fine, however on the report i have a label with the visible property set to No. In the OnFormat property for the section the label appears in, i have the following event procedure;

Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)

If Me.placement >= 2 Then
Me.labelname.Visible = True
Else
Me.lablename.Visible = False
End If
End Sub

The procedure checks the number of records per person and only displays the label where the count is >= 2.

However, i im encountering problems where there are no records for the dates entered by the user, i get the following error msg;

Run Time Error '2427'
You entered an expression that has no value

How do i get around this? can anyone help?
 
In the On NoData event of your report, put some code like this:
Code:
Private Sub Report_NoData(Cancel As Integer)
MsgBox ("No records found for the specified date range")
Cancel = True
End Sub
This code will inform the user that no records were found and then cancel the generation of the report.....
 
Thank you very much, that works perfectly!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top