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 / New Users / February 2006

Tip: Looking for answers? Try searching our database.

use vba to find a record on my form searching all phone fields in

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jjbra - 14 Feb 2006 05:07 GMT
Hi,
   I Am Trying to search a table that has three phone fields, I want to
have the user type in one phone number and be able to select it and have
access put that record on my form.

                                                   Can you help me ?

                                                                  Thanks in
Advance
John Vinson - 14 Feb 2006 05:55 GMT
>Hi,
>    I Am Trying to search a table that has three phone fields, I want to
[quoted text clipped - 5 lines]
>                                                                   Thanks in
>Advance

You don't really need much (or any!) VBA to do this.

Put an unbound textbox named txtFindPhone on your Form. Create a Query
based on your table. Put

[Forms]![YourFormName]![txtFindPhone]

on the Criteria line under HomePhone, WorkPhone, CellPhone (or
whatever the fields are), on three separate lines - so it will use OR
logic to find it in any one of the fields; and include all the other
fields you want to see in the query.

The one snippet of VBA would be in txtFindPhone's AfterUpdate event:

Private Sub txtFindPhone_AfterUpdate()
Me.Recordsource = "YourQueryName"
End Sub

                 John W. Vinson[MVP]    
 
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.