Hi! I have a code..
and..
Its working on my first project. but when i use it on my new project which is the same with my first project. It has a problem regarding on filtering. When I search/filter on my new project, it only show the first record either I put a "Card_Numbe r" on that or it is Null.
I can't see any error on my code. but I'm confuse about what's happening when I'm searching/filtering a record.
Thanks in advanced (~.^)olll
Code:
Private Sub Command18_Click()
'Update the record source
Me.SMS_ValidateSubform.Form.RecordSource = "SELECT * FROM SMS " & BuildFilter
' Requery the subform
Me.SMS_ValidateSubform.Requery
End Sub
Code:
Private Function BuildFilter() As Variant
Dim varWhere As Variant
Dim varColor As Variant
Dim varItem As Variant
Dim intIndex As Integer
varWhere = Null ' Main filter
' Check for LIKE First Name
If Me.Text16 > "" Then
varWhere = varWhere & "[Card_Number] LIKE """ & Me.Text16 & "*"" AND "
End If
' Check if there is a filter to return...
If IsNull(varWhere) Then
varWhere = ""
Else
varWhere = "WHERE " & varWhere
' strip off last "AND" in the filter
If Right(varWhere, 5) = " AND " Then
varWhere = Left(varWhere, Len(varWhere) - 5)
End If
End If
BuildFilter = varWhere
End Function
I can't see any error on my code. but I'm confuse about what's happening when I'm searching/filtering a record.
Thanks in advanced (~.^)olll
Comment