DCount with Multiple Criteria (1 Viewer)

ne1983

New member
Local time
Tomorrow, 04:21
Joined
Nov 24, 2015
Messages
6
Hey
Having an issue with this , any help appreciated!

[tblMaint_Rqst_Request] = table of maintenance requests
[MT_Rqst_Location] = field in table containing location (can be numerical or text)
[MT_Status_Value] = field in table containing status of job as number, ie 1= open, 2 = in progress, ...., 6 = closed.

I want a DCount in unbound text box simply showing how many jobs are NOT CLOSED (ie status < 6) for the same location when looking at a record

Tried the below to no avail :(
DLookUp("[MT_Rqst_location]","[tblMaint_Rqst_Request]","[MT_Status_Value] < 6 AND [MT_Rqst_Location] = ‘" & Forms![frmMain]![frmMaintDashboard].Form![frmMaintDashboardSUB]![MT_Rqst_location]&"'")
 
Last edited:

plog

Banishment Pending
Local time
Today, 13:21
Joined
May 11, 2011
Messages
11,693
Tried the below to no avail

Define 'no avail'. Error message? Unexpected results?

With that said the answer is to always divide and conquer. First I would make it a DCount instead of a Dlookup since that's what you want. Then I would remove all the criteria from it. Just get it to return a valid result. Once you have that, start adding criteria back into it one by one until it stops working. The last criterion you added is the offender.
 

ne1983

New member
Local time
Tomorrow, 04:21
Joined
Nov 24, 2015
Messages
6
thanks plog, error message = #Error

Tried dcount as well - tried a number of troubleshooting and i think its something to do with the <6 and location references.... I can only get it to return the total number of record which is no good.
 

plog

Banishment Pending
Local time
Today, 13:21
Joined
May 11, 2011
Messages
11,693
think its something to do with the <6 and location references.

Yeah, divide and conquer to identify.
 

Minty

AWF VIP
Local time
Today, 19:21
Joined
Jul 26, 2013
Messages
10,382
So applying the dividing and conquering try

Code:
DCount("[MT_Rqst_location]","[tblMaint_Rqst_Request]","[MT_Status_Value] < 6 "
This should give you your count of Locations not at 6... regardless of the location.
 

Users who are viewing this thread

Top Bottom