G
Guest
I am trying to count records in a query using two dates entered by the user
and put it inot a variable called 'intWLDThMonth' . It returns the wrong
count and I can;t work out why.
strSQL = "PARAMETERS [StartDate] Date, [EndDate] Date; "
strSQL = strSQL & "SELECT * From qryJoinThisMonth_old WHERE "
strSQL = strSQL & "DateJoined >=[StartDate] AND DateJoined <= [EndDate];"
Set qdf = CurrentDb.CreateQueryDef("", strSQL)
qdf.Parameters("StartDate") = varStartDate
qdf.Parameters("EndDate") = varEndDate
Set rstContact = qdf.OpenRecordset
If Not rstContact.EOF Then
rstContact.MoveFirst
rstContact.MoveLast
intWLDThMonth = rstContact.RecordCount
End If
Set rstContact = Nothing
Any help much appreciated. Paul Mendlesohn
and put it inot a variable called 'intWLDThMonth' . It returns the wrong
count and I can;t work out why.
strSQL = "PARAMETERS [StartDate] Date, [EndDate] Date; "
strSQL = strSQL & "SELECT * From qryJoinThisMonth_old WHERE "
strSQL = strSQL & "DateJoined >=[StartDate] AND DateJoined <= [EndDate];"
Set qdf = CurrentDb.CreateQueryDef("", strSQL)
qdf.Parameters("StartDate") = varStartDate
qdf.Parameters("EndDate") = varEndDate
Set rstContact = qdf.OpenRecordset
If Not rstContact.EOF Then
rstContact.MoveFirst
rstContact.MoveLast
intWLDThMonth = rstContact.RecordCount
End If
Set rstContact = Nothing
Any help much appreciated. Paul Mendlesohn