Hello, I'm using this code to parse a query and return the record count using strCriteria. TN is a string and SignInDate is a date. RecordCount should be 3 but it is returning the total number of records in the query. It appears findfirst is not using the strCriteria.
I'm receiving any errors i just do not get the right recordcount. Is my code accurate? should I look into using a query def?
Jim
Code:
Public Sub DupSignIn(TN As String)
Debug.Print
Dim dbs As Database
Dim rstSignIn As Recordset
Dim strCriteria As String
Set dbs = CurrentDb
Set rstSignIn = dbs.OpenRecordset("qryDupSignIn", dbOpenDynaset)
Dim SignInDateHolder As Date
Dim rcdSignIn As Integer
SignInDateHolder = Nz(Forms!frmMain!frmSignIn_subform.Form!SignInDate, 0)
strCriteria = "[SignInDate]= # " & SignInDateHolder & "# and [TicketNum]= '" & TN & "'"
rstSignIn.MoveLast
rstSignIn.MoveFirst
rstSignIn.FindFirst strCriteria
If Not (rstSignIn.NoMatch) Then
MsgBox "Match Found"
rcdSignIn = rstSignIn.RecordCount
Else
End If
rstSignIn.Close
Set rstSignIn = Nothing
End Sub
Jim