Solved DCOUNT() ISSUE (1 Viewer)

Ashfaque

Student
Local time
Today, 17:21
Joined
Sep 6, 2004
Messages
894
I tried following and it is producing following errors.

X = DCount("*", "T_ProjAssigneeDetails", "ProjNum = '" & Me!CboSearchProj.Column(0) & " ' " And AssigneeActive Is Null) = False '")
Run-time error 424 - Object Required

X = DCount("*", "T_ProjAssigneeDetails", "ProjNum = '" & Me!CboSearchProj.Column(0) & " ' " And "AssigneeActive = 0")
Run-time error '13' - Type mismatch
 

cheekybuddha

AWF VIP
Local time
Today, 12:51
Joined
Jul 21, 2014
Messages
2,278
Code:
X = DCount("*", "T_ProjAssigneeDetails", "ProjNum = '" & Me!CboSearchProj.Column(0) & " ' " And AssigneeActive Is Null) = False '")
                                                                                       ^  ^                           ^     ^   ^
                                                                                       |  |                           |     |   |
                                                                       Remove this space  |       No matching open bracket  |   |
                                                                                          |                               Why?  |
                                                                                This double quote causes error                  |
                                                                                                             unmatched, unnecessary
                                                                                                            
X = DCount("*", "T_ProjAssigneeDetails", "ProjNum = '" & Me!CboSearchProj.Column(0) & "' And (AssigneeActive = False OR AssigneeActive Is Null)")
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:51
Joined
May 7, 2009
Messages
19,242
the field AssigneeActive is Yes/No datatype.
it Cannot be Null, and the Default if not checked is No/False.
 

Ashfaque

Student
Local time
Today, 17:21
Joined
Sep 6, 2004
Messages
894
Code:
X = DCount("*", "T_ProjAssigneeDetails", "ProjNum = '" & Me!CboSearchProj.Column(0) & " ' " And AssigneeActive Is Null) = False '")
                                                                                       ^  ^                           ^     ^   ^
                                                                                       |  |                           |     |   |
                                                                       Remove this space  |       No matching open bracket  |   |
                                                                                          |                               Why?  |
                                                                                This double quote causes error                  |
                                                                                                             unmatched, unnecessary
                                                                                                           
X = DCount("*", "T_ProjAssigneeDetails", "ProjNum = '" & Me!CboSearchProj.Column(0) & "' And (AssigneeActive = False OR AssigneeActive Is Null)")
Thanks Cheekybuddah,

Yes, it is working. Only thing is I need Not Is Null with second criteria.
 

Ashfaque

Student
Local time
Today, 17:21
Joined
Sep 6, 2004
Messages
894
the field AssigneeActive is Yes/No datatype.
it Cannot be Null, and the Default if not checked is No/False.
Excellent point Arnel,

I changed just now to not null and by default value to ZERO
 

Users who are viewing this thread

Top Bottom