Discussion Locked

Counting Records (Form and Report)

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Depending on whether the user wants to view results of a custom query in a report or form, I am opening the report or form with a filter string with the Docmd.OpenForm function.
How do I detect whether the form or report will contain any records after the filter is applied?
I want to msgbox the user if no records will be returned.

1 reply

by chrissaw

Hi,
To do that, use the RecordSetClone property of the form or report. Use it on the On Open event for both objects.
Ex: If Me.RecordSetClone.RecordCount > 0 Then
Do something
End If

Christian

This discussion is closed to new replies.