Results 1 to 5 of 5
  1. #1
    Bluecider is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    6

    Count Boolean True(Yes) Records from Table and report on Unbound Form's Textbox

    So, this should be simple right?
    But I'm going crazy trying to work this out and have done over an hour of searching online, whits end...

    I'm trying to take a count of records that have a checkbox checked (Yes/True) and return this total to a textbox on an unbound form by using the CONTROL SOURCE property of the textbox.

    Underlying Table and Field:


    tbl_JOBS = Table
    Interviewed = Field (Boolean yes/no)

    What do I put in the Unbound Form's Control Source property to return what I want? I've tried things like this to no avail: =Abs(Sum(IIf([tbl_JOBS]![Interviewed]=Yes,1,0)))

    I just keep getting #ERROR in the textbox...

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Did you try the DCount function?

    =Dcount("*","[TblJobs]","Interviewed = True")

    In your original expression, the error is in using "Sum" - Access does not have a "Sum" function (though SQL does)
    Last edited by John_G; 09-09-2017 at 10:10 PM. Reason: Correct the expression syntax

  3. #3
    Bluecider is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    6
    =DCount("*",[tbl_JOBS],"Interviewed = True")

    This returns in the textbox: #Name?

  4. #4
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    See my correction -

    It should be =Dcount("*","[TblJobs]","Interviewed = True") - quotation marks around the table name.

  5. #5
    Bluecider is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    6
    Thanks. That works. I could have sworn I tried the Dcount statement above in one of my attempts, but maybe I had something small off.
    Thanks muchos!

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

Similar Threads

  1. Replies: 23
    Last Post: 01-27-2016, 01:42 PM
  2. Replies: 2
    Last Post: 12-22-2015, 09:09 PM
  3. Adding Records from Unbound Form to Database Table
    By lzook88 in forum Programming
    Replies: 19
    Last Post: 09-13-2015, 05:18 PM
  4. Dynamic Report with Unbound Textbox and Label
    By illicited in forum Reports
    Replies: 1
    Last Post: 02-27-2015, 12:03 PM
  5. Unbound textbox and report linked to vba
    By Shambler2 in forum Programming
    Replies: 7
    Last Post: 06-09-2011, 04:29 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