Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2002
    Posts
    173

    Unanswered: no data option in form like a report

    Is there an option for some kind of event to take place if a form that is based on a query comes up with no data? On a report you can set an event on the "on no data", anything similar for a form?

  2. #2
    Join Date
    Nov 2002
    Location
    Hillsboro, OR, USA
    Posts
    59

    Re: no data option in form like a report

    How about:
    Code:
    Private Sub Form_Current()
        
        If Me.Recordset.RecordCount = 0 Then MsgBox "Sorry,  no records found."
    
    End Sub

  3. #3
    Join Date
    Jun 2002
    Posts
    173
    I tried it out but no message box appears. The form actually shows nothing at all not even buttons when there's no records. I tried =null instead of zero with no luck. Any other ideas?

  4. #4
    Join Date
    Nov 2002
    Location
    Hillsboro, OR, USA
    Posts
    59

    Re: no data option in form like a report

    What about moving to the forms OnLoad event:
    Code:
    Private Sub Form_Load()
        
        If Me.Recordset.RecordCount = 0 Then MsgBox "Sorry,  no records found."
    
    End Sub
    Any difference?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •