dcount - type mismatch

Help with syntax - getting type mismatch on last half of string

Need record count of ReqNo where checkbox (Reviewed...) is true per ReqNo.

Private Sub Reviewed_With_Question_AfterUpdate()
   Dim x As Integer
   Dim nReqNo As String
   
   nReqNo = Me.ReqNo
   x = DCount("ReqNo", "UseCases", "ReqNo =" & nReqNo And [Reviewed With Question] = True)
    If Me.Reviewed = True Then
        Me.Reviewed = False
    End If
    If x > 0 Then
         [Forms]![RequirementsReview]![Reviewed With Question] = True
    Else
         [Forms]![RequirementsReview]![Reviewed With Question] = False
    
    End If
   [Forms]![RequirementsReview]![DateModified] = Date
    Me.DateModified = Date
    Me.Repaint

End Sub

Open in new window

Thanks,  What am I missing.
Karen SchaeferBI ANALYSTAsked:
Who is Participating?
 
Rey Obrero (Capricorn1)Commented:
x = DCount("ReqNo", "UseCases", "ReqNo =" & nReqNo & " And [Reviewed With Question] = True")

or

x = DCount("ReqNo", "UseCases", "ReqNo =" & nReqNo & " And [Reviewed With Question] = -1")


if reqNo is Text

x = DCount("ReqNo", "UseCases", "ReqNo ='" & nReqNo & "' And [Reviewed With Question] = True")
0
 
Rey Obrero (Capricorn1)Commented:
x = DCount("ReqNo", "UseCases", "ReqNo =" & nReqNo & " And [Reviewed With Question] = True)
0
 
Karen SchaeferBI ANALYSTAuthor Commented:
Thanks Rey that did the trick.

K
0
 
Karen SchaeferBI ANALYSTAuthor Commented:
Thanks Rey that did the trick.

K
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.