Results 1 to 2 of 2
  1. #1
    skwilliamson is offline Novice
    Windows Vista Access 2003
    Join Date
    Dec 2009
    Posts
    3

    Return 0 if no records found

    I have a form with a textbox "Text360". The form also contains a subform based on a query "qryCSLWOSCt"

    The query contains a value "CountOfReason" that I would like to return to Text360.



    If CountOfReason is null, the value returned is 0.

    What is the best way to accomplish this?

    Here's what I've tried so far:

    Text360 = Nz(qryCSLWOSCt!CountOfReason,0)

    then I get this message.

    "You entered an expression that has no value."

    I've also tried this:
    If IsNull(DCount("*", "qryCSLWOSCt")) Then Text360 = 0 Else Text360 = qryCSLWOSCt!CountOfReason

    this works if there is a value, if not I get this message.
    "The value you entered isn't valid for this field."

    It appears that a problem appears when the query is blank.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922

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

Similar Threads

  1. The search key was not found in any record
    By virtualprg in forum Import/Export Data
    Replies: 46
    Last Post: 08-26-2014, 10:51 AM
  2. Replies: 5
    Last Post: 10-08-2009, 05:15 AM
  3. Replies: 0
    Last Post: 08-04-2009, 08:51 PM
  4. Replies: 4
    Last Post: 01-29-2009, 02:43 AM
  5. Return records not updated by update query
    By ars80 in forum Queries
    Replies: 2
    Last Post: 05-01-2006, 09:23 AM

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