Filtering problems

Solved/Closed
Cindy - Aug 20, 2010 at 11:43 AM
 Cindy - Aug 21, 2010 at 03:30 AM
Hello,

I have a microsoft database access and I'm trying to filter some records. This is what I do:

1. I have a form for query purposes, in tha form I have also a combo box which I use to select the name of the employee

2. I have another button to filter the records selected in that combobox, but when filtering, sometimes for some specific names is bringin me on ly th records for that name and for other names is bringing me 3, 4 or 5 more names, why? Here is an example of my filter code, any help would be kindly appreciated. thanks

Private Sub cmdFilter_Click()

Dim strWHERE As String
Dim lngLen As Long
Const conJetDate = "\#mm\/dd\/yyyy\#"


If Not IsNull(Me.campofiltro5) Then
strWHERE = strWHERE & "([IDAutonumemp] Like ""*" & Me.campofiltro5 & "*"") AND "
End If


lngLen = Len(strWHERE) - 5
If lngLen <= 0 Then
MsgBox "You must filter any criteria", vbInformation, "No filter found."
Else
strWHERE = Left$(strWHERE, lngLen)

Me.Filter = strWHERE
Me.FilterOn = True
End If
End Sub


Related:

2 responses

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Aug 20, 2010 at 01:56 PM
Well you are using "LIKE" statement, so I were to search for Straw, I would get Straw and Strawberry and any thing else that contain "S.T.R.A.W.". Could that be the reason ?
0
Hi again, umm do you know how to fix this issue

Thanks again
0
Thank you, I wasne't pretty sure at the beginning but I noticed about the "LIke" thanks now its fixed
0
Umm, sorry but how do you fix that?

Thank you
0