dcount in query builder

swmorin

Registered User.
Local time
Yesterday, 19:33
Joined
Jan 10, 2012
Messages
66
All I am trying to get dcount to work in the query builder.

In the below example [BLOCKID] is supposed to be from the current record of the query. I can't get to work.

Code:
count2: DCount("[REQTYPE]","tbl_instructor_req","tbl_instructor_req.BLOCKID = [BLOCKID]")
 
The BLOCKID in the current record needs to referenced outside of the quote marks. So if BLOCKID is numeric this is what you want:

count2: DCount("[REQTYPE]","tbl_instructor_req","tbl_instructor_req.BLOCKID = " & [BLOCKID])

If it is text use this:

count2: DCount("[REQTYPE]","tbl_instructor_req","tbl_instructor_req.BLOCKID = '" & [BLOCKID] & "'")

And then there's always the case for just bringing in the tbl_instructor_req table into the query you are working with and directly counting the [REQTYPE] field without using a DCOUNT.
 

Users who are viewing this thread

Back
Top Bottom