PDA

View Full Version : issue with .filter on a recordset



nrp@ncad.com
10-23-2013, 08:24 AM
getting a run-time error 3464
"data type mismatch in criteria expression"
flagged on line Set rsFiltered = .OpenRecordset
first debug.print recordcount works fine and # is correct.

trying to automate the filtering of the rs.
have hard coded 204178 as my filter for job field.
this should return a record count of 7
can't get past the error.

Neil




Public Sub seqissue()


Dim rs As Recordset
Dim rsFiltered As Recordset
Dim strSQL As String


strSQL = "SELECT dbo_Job1.Job, dbo_Job_Operation1.Sequence, dbo_Job_Operation1.Work_Center, dbo_Job_Operation1.Status " _
& "FROM dbo_Job1 INNER JOIN dbo_Job_Operation1 ON dbo_Job1.Job = dbo_Job_Operation1.Job " _
& "GROUP BY dbo_Job1.Job, dbo_Job_Operation1.Sequence, dbo_Job_Operation1.Work_Center, dbo_Job_Operation1.Status, dbo_Job1.Status " _
& "HAVING (((dbo_Job1.Status)='active')); " _

Set rs = CurrentDb.OpenRecordset(strSQL)
rs.MoveLast
rs.MoveFirst


With rs
Debug.Print .RecordCount
.Filter = "[Job]=204178"
Set rsFiltered = .OpenRecordset
rsFiltered.MoveLast
rsFiltered.MoveFirst
Debug.Print rsFiltered.RecordCount
.Close
End With


Set rs = Nothing


End Sub

mrojas
11-07-2013, 05:45 AM
Have you tried:

Dim lngJobNo as Long

then
.Filter="[Job]=" & lngJobNo

driverellis
11-18-2013, 09:57 PM
Good job i appreciate your work.because I have same problem but you post solve my problem.

mrojas
11-19-2013, 09:56 AM
Glad to contribute to this website with useful information.:thumb

shahid11
11-19-2013, 09:58 PM
I am interested in this topic and would like to find out some more information as my friend need information on this topic. Do you have any other articles about this?
Eventually i am come here and want to say you that thanks for sharing your concept regarding the post. I am also feeling that this is one of the good posts.
I thought it was going to be some boring old post, but it really compensated for my time. I will post a link to this page on my blog. I am sure my visitors will locate that extremely useful

shahid11
01-24-2014, 12:30 AM
I am interested in this topic and would like to find out some more information as my friend need information on this topic. Do you have any other articles about this?
Eventually i am come here and want to say you that thanks for sharing your concept regarding the post. I am also feeling that this is one of the good posts.
I thought it was going to be some boring old post, but it really compensated for my time. I will post a link to this page on my blog. I am sure my visitors will locate that extremely useful
Nice post.............