DCount Issue

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have inherited an Access DB and I have been trying to clean up extra
Qureies and replace with DCount.

I have been fairly successful but.......

I want to comine 2 that I am using and make them the inverse . One is
looking to Count Warrany repairs =DCount("[DATE
SHIPPED]","qryQualityListRepairsShippedbyDate","[WARRANTY] = 'Y'") - Seems to
work fine

The other counts a text field Called [Reason for Return] and I am counting
if the Field Starts with "DOA" or starts with "D.O.A." =DCount("[DATE
SHIPPED]","qryQualityListRepairsShippedbyDate","[REASON FOR RETURN] Like
'DOA*' OR [REASON FOR RETURN] like 'D.O.A.*'") Seems to work fine

Now I am Trying to Count Standard Repairs which would be Warranties NOT = to
"Y" or (NOT Like Starting with DOA* or Not Like Starting with D.O.A*). I
think the OR, AND - either I am getting an Error (Syntac) or the wrong
figure (Logic).

Any suggestions - Thanks

Joe
 
This is something that confuses people all the time. If you want to count a
field looking for two values you use OR

If x = "3" Or x = "9"

Will return only rows where x is "3" or "9"

If you are looking to omit "3" and "9", you would use And

If x <> "3" And x <>"9"

Will return all rows except where x is "3" or "9"

If you were to say

If x <> "3" Or x <> "9"

Will return all rows

So, to your specific problem:
=DCount("[DATE SHIPPED]","qryQualityListRepairsShippedbyDate", _
"[REASON FOR RETURN] Not Like 'DOA*' And [REASON FOR RETURN] _
Not like 'D.O.A.*' And "[WARRANTY] <> 'Y'")
 
Back
Top