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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top