Results 1 to 5 of 5
  1. #1
    smc678 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    65

    Can you narrow down to a specific word in a Dlookup?


    Im trying to Dcount in a report agianst a query but I need to narrow down to a specific name within the [Catgory] for example [Category] ='Allowable' How do I fit that into the statement?


    =Nz(DCount("[Category]","qryAttendanceHistorybyDept","[Assoc Nm]=Reports!rptAssociateAttendanceHistorybyDept![Assoc Nm]"),0)

  2. #2
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    SELECT Allowable, Nz(Dcount("[Allowable]","qryAttendanceHistoryByDept")) AS MyCount FROM YourTableHere WHERE Allowable = True

    Untested and basically a guess.
    Dale

  3. #3
    smc678 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    65
    Did not work. I need it to match the Assoc Nm on both report and query to return only those results

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    In looking at the syntax for the DCount function, in the criteria clause, the value (text) has to be concatenated to the field name. I'm not sure this will work because it looks like you are trying to get a value from a report. I've never used a value from a report, only forms...... sooooo .......

    But try this:
    Code:
    =Nz(DCount("[Category]","qryAttendanceHistorybyDept", "[Assoc Nm] = '" & Reports!rptAssociateAttendanceHistorybyDept![Assoc Nm] & "'"),0)
    Note the delimiters in the criteria clause....

  5. #5
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    SELECT Allowable, Nz(Dcount("[Allowable]","qryAttendanceHistoryByDept")) AS MyCount FROM YourTableHere WHERE Allowable = True
    Can you explain why/where this did not work.
    I am trying to better understand SQL and hoping your explanation will help.

    Thanks,
    Dale

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

Similar Threads

  1. dlookup to narrow search results
    By blappy347 in forum Programming
    Replies: 2
    Last Post: 03-29-2013, 02:25 PM
  2. Formating the Date into Word as a specific format
    By drmsktchr in forum Import/Export Data
    Replies: 0
    Last Post: 02-12-2013, 11:08 AM
  3. Replies: 1
    Last Post: 06-15-2012, 05:51 PM
  4. Generating List and Narrow down to type
    By bhaktharvali in forum Database Design
    Replies: 2
    Last Post: 01-07-2012, 03:39 AM
  5. Split string when specific word is found
    By DB4284 in forum Programming
    Replies: 1
    Last Post: 11-18-2010, 03: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