I have this on a form called "frmInQuiry".
It is a text box and I would like to Filter out the data but this only works
if account = AccSer. How can I put a wild card(*) at the end in the text box
called AccSer.
The person does not need to know the whole Account.
Private Sub AccSer_LostFocus()
Dim strFilter As String
strFilter = ""
FilterOn = True
If Not IsNull(Forms!frmInQuiry.AccSer) Then
If strFilter = "" Then
'strFilter = "Forms!frmInquiry.Account = Forms!frmInquiry.AccSer"
strFilter = "Account = forms!frmInquiry.AccSer"
Else
strFilter = strFilter & " and Account = Forms!frmInquiry.AccSer"
End If
End If
Me.Filter = strFilter
Requery
End Sub
Thank you in advance for any help
Roger Carlson - 14 Nov 2006 15:43 GMT
Try this:
strFilter = "Account Like" & forms!frmInquiry.AccSer & "*"

Signature
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
> I have this on a form called "frmInQuiry".
>
[quoted text clipped - 26 lines]
>
> Thank you in advance for any help
Stefan Hoffmann - 14 Nov 2006 15:52 GMT
hi,
> I have this on a form called "frmInQuiry".
> It is a text box and I would like to Filter out the data but this only works
> if account = AccSer. How can I put a wild card(*) at the end in the text box
> called AccSer.
> The person does not need to know the whole Account.
> Private Sub AccSer_LostFocus()
> Dim strFilter As String
[quoted text clipped - 14 lines]
> Requery
> End Sub
This can be improved in some ways:
Private Sub AccSer_LostFocus()
Dim strFilter As String
strFilter = ""
If Not IsNull(AccSer) Then
strFilter = "Account LIKE '" & Replace(AccSer, "'", "''") & "*'"
End If
Me.Filter = strFilter
Me.FilterOn = True
End Sub
mfG
--> stefan <--