General discussion

Locked

Counting Records (Form and Report)

By Shanghai Sam ·
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.

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Counting Records (Form and Report)

by ChrisSaw In reply to Counting Records (Form an ...

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

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums