DCount syntax

SteveE

Registered User.
Local time
Today, 16:32
Joined
Dec 6, 2002
Messages
221
I have a form which contains a count of scanned items if, OK or ERR from my TblLog.

I have 2 displayed fields which show the numder of recorded errors using Dlookups

Me.ScansOK = DCount("[Err_OK]", "TblLog", "[Err_OK] = 'OK'")
Me.ScansERR = DCount("[Err_OK]", "TblLog", "[Err_OK] = 'ERR'")

I want to only count the Errors / OK where the Station is equal to the Station ID on my form
i.e. Me.ScansOK = DCount("[Err_OK]", "TblLog", "[Err_OK] = 'OK'") where table TblLog.Station = myform.StationID
Is this possible with DCount or is there a better way ?

Any help appriciated

Steve
 
yes, we can add more criteria in the Dxxx() function same as we used in the select where clause.

Me.ScansOK = DCount("[Err_OK]", "TblLog", "[Err_OK] = 'OK' and Station='" & me.StationID.Value & "'")
Me.ScansERR = DCount("[Err_OK]", "TblLog", "[Err_OK] = 'ERR' and Station='" & me.StationID.Value & "'")
 
Many thanks to you both for your replies I will be back on site on Monday to try out thanks again
Steve
 

Users who are viewing this thread

Back
Top Bottom