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 / Forms / March 2008

Tip: Looking for answers? Try searching our database.

return all entries where name contains "LEN"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ali - 05 Mar 2008 04:48 GMT
I have  a table: (Dummy Scenario)
-ID
-Name
-Join_Date
-Remark

-------------------------------------------------------------------------------------
I'd like to:

Retrieve all entries where the name contains "LEN" ,

so names such as "ALLEN", "LENNY", "LENUS" etc.. should be returned.

(In SQL, we write --> where the name LIKE "*LEN*", )

-------------------------------------------------------------------------------------
My question:

1) how can i do it in a form ?
2) Is that possible to return all results into a "DataGrid" in MS Access
form ? if so , how ?

Dear expert, thanks a lot !

Signature

Allen Phailat Wongakanit

Allen Browne - 05 Mar 2008 07:38 GMT
The filter of a form is the same as a WHERE clause in SQL.

Therefore something like this:

   Private Sub txtMatchName_AfterUpdate()
       dim strWhere As String
       If Not IsNull(Me.txtMatchName) Then
           If Me.Dirty Then Me.Dirty = False    'Save first.
           strWhere = "[MyNameField] Like ""*" & Me.txtMatchName & "*"""
           Me.Filter = strWhere
           Me.FilterOn = True
       End If
   End Sub

If the quotes don't make sense, see:
   http://allenbrowne.com/casu-17.html

For a more comprehensive example, see:
   Search form - Handle many optional criteria
at:
   http://allenbrowne.com/ser-62.html

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I have  a table: (Dummy Scenario)
> -ID
[quoted text clipped - 17 lines]
> 2) Is that possible to return all results into a "DataGrid" in MS Access
> form ? if so , how ?
 
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.