Results 1 to 3 of 3
  1. #1
    Swilliams987's Avatar
    Swilliams987 is offline Need Not Be Novice
    Windows XP Access 2010 32bit
    Join Date
    Jan 2011
    Location
    Sacramento, CA
    Posts
    29

    Returned No Results Message Box

    Hello!



    I have a parameter query that, when run, asks the user for the county's name and the year they are interested in looking for data, qryLRCACountyYear. This query is used as a filter for frmLRCACountyYear.

    This works beautifully when there are results to show. But if there aren't any results, then it opens frmLRCACountyYear as a blank form. When no results are found, how can I get a message box to say "no results found" and then opening frmMainMenu after pressing "ok"?

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    I'm not sure, but right away i can think of something like this on the load event of the form:

    Code:
    if me.recordsetclone.recordcount = 0 then
       msgbox "no records found!"
          docmd.close acform, me.name
          docmd.openform "frmMainMenu"
    end if

  3. #3
    Swilliams987's Avatar
    Swilliams987 is offline Need Not Be Novice
    Windows XP Access 2010 32bit
    Join Date
    Jan 2011
    Location
    Sacramento, CA
    Posts
    29
    That's the code that I've been using...or very similar to it. I tried what you posted and no luck, but then....I realized that I had other similar code in two other places on two other events. Once I deleted that code everything worked! YAY! Thanks again!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 11-16-2010, 02:38 PM
  2. Replies: 1
    Last Post: 09-22-2010, 08:03 AM
  3. Replies: 4
    Last Post: 07-28-2010, 11:25 AM
  4. Replies: 6
    Last Post: 09-25-2009, 12:40 PM
  5. Counting returned records in a query
    By johncob in forum Queries
    Replies: 0
    Last Post: 02-11-2009, 05:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums