Link to home
Start Free TrialLog in
Avatar of Tbyrd777
Tbyrd777

asked on

MS Access, Dcount, Multiple Criteria

Hello,

I have a query where I would like one field to return the count of records that have the same field value as the current record.  For example, my query contains 9 records, 5 of those records have one fiscalwk value and the other four have a different fiscalwk value.  I would like to return a 4 or a 5 depending on the fiscalwk value.  Currently, I'm using the following dcount expression

Total_Wks: DCount([Forecast_Amt],"Q_Calc_New_FM_Store_Adjustment",[Forecast_Amt]<>0 And [T_Data_Forecast_Master_Temp]![Fiscal_Period]=[T_Data_Forecast_Master_Temp]![Fiscal_Week])

The value is returning all 9 weeks for each record instead of the 4 or 5 depending on the actual recrods with that fiscal week.

Any assistance would be greatly appreciated.

Thanks,

Tbyrd
SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That also assumes that Fiscal_Week is numeric.  If it is text:

Total_Wks: DCount("*", "Q_Calc_New_FM_Store_Adjustment","Forecast_Amt<>0 And Fiscal_Period = " & CHR(34) &  T_Data_Forecast_Master_Temp]![Fiscal_Week] & CHR(34))