Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2005
    Posts
    2

    Unanswered: No records returned in a Query

    Hi All:

    I have a form based on a query that uses a parameter to find records and what I am looking to do is to have a message box appear when no records are found instead of having a blank form appear. So if i search for G* and no matching records are found, I don't even see the form, all I see is a message box say "Sorry, no matching records"

    Sort of the same idea as in a report where you can set an event procedure On No Data.

    Thanks in advance.

    Grant

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    You could do it this way I suppose;

    In your Form's OnCurrent Event (first code):
    Code:
    If IsNull(Me.RecordID) Then  ' or whatever field may be blank if there is no Record match.
       Me.Visible = False
       MsgBox "No Matching Records!"
       DoCmd.Close
    End If

  3. #3
    Join Date
    Mar 2005
    Posts
    2
    THANKS!!!!

    I worked great!!!


Posting Permissions

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