I have a bunch of reports with the code below (highlighting every 2nd line). When there's no records to report, the code collapses ('cause you can't divide zero by 2). I've tried saying using 'recordset.recordcount <1 docmd.close" (or something like that), but it doesn't like the recordset deal for some reason. Says its not available in MDB, even though I've copied it from somewhere else where it does work.
Basically, what we want to happen:
- if there's no records, we want a message box on the preview command button that says "no records to view"
- if there are records we want to run the code below (which is on report open)
Basically, what we want to happen:
- if there's no records, we want a message box on the preview command button that says "no records to view"
- if there are records we want to run the code below (which is on report open)
Code:
If Me.Counter / 2 <> Int(Me.Counter / 2) Then
Me.Detail.BackColor = 14803425
Else
Me.Detail.BackColor = 16777215
End If