Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Apr 2003
    Location
    Calgary, Alberta
    Posts
    327
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Check for no data on query (Access 2000)

    I have a form that checks though each consultant and finds out if they have any invoices outstanding. If so, then an email is send out (via RTF from a Report) to their email address. If no data is found, I do not want the report to be send. Is there a way to check if a query returns no results so I can avoid sending an email

    Thanks

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Check for no data on query (Access 2000)

    You can use Dcount to count the number of records in a query.

    if dcount("[InvoiceID]", "qrymyquery") > 0 then
    docmd.sendobject etc
    else
    ' do nothing
    end if


    This assumes that qrymyquery already has a parameter in it that selects the current consultant. If it didn't you would have to add a where clause to the Dcount.
    Regards
    John



  3. #3
    3 Star Lounger
    Join Date
    Apr 2003
    Location
    Calgary, Alberta
    Posts
    327
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Check for no data on query (Access 2000)

    Thanks, that works great [img]/forums/images/smilies/smile.gif[/img]

Posting Permissions

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