A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old February 14th, 2006, 06:07 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default use vba to find a record on my form searching all phone fields in

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
  #2  
Old February 14th, 2006, 06:55 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default use vba to find a record on my form searching all phone fields in

On Mon, 13 Feb 2006 21:07:27 -0800, "jjbra"
wrote:

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


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]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Navigation buttons Dorothy Using Forms 10 August 1st, 2007 08:58 PM
Move feild entries from form to form using global variables JackCGW General Discussion 11 November 14th, 2005 06:22 AM
Combo Box NotInList - How To Add Data To Underlying Table 10SNUT Using Forms 19 July 8th, 2005 09:12 PM
Access Mail Merge to Word.doc files ? RNUSZ@OKDPS Setting Up & Running Reports 1 May 18th, 2005 06:31 PM
Form Doesn't Go To New Record Steve New Users 15 May 16th, 2004 04:33 PM


All times are GMT +1. The time now is 11:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.