General discussion

  • Creator
    Topic
  • #2129325

    Counting Records (Form and Report)

    Locked

    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.

All Comments

  • Author
    Replies
    • #3424664

      Counting Records (Form and Report)

      by chrissaw ·

      In reply to Counting Records (Form and Report)

      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

Viewing 0 reply threads