Isskint
Slowly Developing
- Local time
- Today, 18:10
- Joined
- Apr 25, 2012
- Messages
- 1,302
A little tip that may save some minutes, hours or even longer, not to mention getting a headache.
In a recent post - http://www.access-programmers.co.uk/forums/showthread.php?t=228412 -kasmax asks about a common issue that many people have encountered (and will again I am sure). When i encouter the need for multiple criteria in a Dsum, Dcount, Dlookup etc I do the following:
In a recent post - http://www.access-programmers.co.uk/forums/showthread.php?t=228412 -kasmax asks about a common issue that many people have encountered (and will again I am sure). When i encouter the need for multiple criteria in a Dsum, Dcount, Dlookup etc I do the following:
- Record each criteria seperately first (to check for syntax and data return accuracy)
- Dcount("[Field]","[tblTableName]","[Field1]='" & [fText] & "'")
- Dcount("[Field]","[tblTableName]","[Field2]=" & [fValue] & "")
- Dcount("[Field]","[tblTableName]","[Field3]=#" & [fDate] & "#")
- etc
- Write the multi criteria function as Dcount("[Field]","[tblTableName]","((A) AND (B) AND (C))") etc
- Copy criteria for each part and paste over A, B, C etc
- "[Field1]='" & [fText] & "'"
- "[Field2]=" & [fValue] & ""
- "[Field3]=#" & [fDate] & "#"
- Dcount("[Field]","[tblTableName]","(("[Field1]='" & [fText] & "'") AND ("[Field2]=" & [fValue] & "") AND ("[Field3]=#" & [fDate] & "#"))")