Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

Trying to use Like * at the end

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Crazyhorse - 14 Nov 2006 15:36 GMT
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 <--
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.