Peter Bellamy
Registered User.
- Local time
- Today, 20:32
- Joined
- Dec 3, 2005
- Messages
- 295
I am trying to simplify a DCount statement as it has to make 10 tests in its criteria.
The a slightly simplified version for just 2 criteria is:
crit1 = "SPMB2/001"
crit2 = "SPCOH2/001"
number = DCount("[goods_no]", "Goods", "[goods_returnno]=Form.[return_no] And [goods_partno]= '" & crit1 & "' Or [goods_returnno]=Form.[return_no] And [goods_partno]= '" & crit2 & "'")
So what I would like to do is contruct 10 lines like:
crit01 = "[goods_returnno]=Form.[return_no] And [goods_partno]= 'SPMB2/001'"
crit02 = "[goods_returnno]=Form.[return_no] And [goods_partno] = 'SPCOH2/001'"
and concatanate them with Or's in between.
I don't seem to be able to get the correct syntax for crit01 and crit02.
Can someone point me in the right direction?
Cheers
The a slightly simplified version for just 2 criteria is:
crit1 = "SPMB2/001"
crit2 = "SPCOH2/001"
number = DCount("[goods_no]", "Goods", "[goods_returnno]=Form.[return_no] And [goods_partno]= '" & crit1 & "' Or [goods_returnno]=Form.[return_no] And [goods_partno]= '" & crit2 & "'")
So what I would like to do is contruct 10 lines like:
crit01 = "[goods_returnno]=Form.[return_no] And [goods_partno]= 'SPMB2/001'"
crit02 = "[goods_returnno]=Form.[return_no] And [goods_partno] = 'SPCOH2/001'"
and concatanate them with Or's in between.
I don't seem to be able to get the correct syntax for crit01 and crit02.
Can someone point me in the right direction?
Cheers