Searching in combox using one field or another

G

Guest

I'm using Access 2003. I'm looking for an advice.
I have a table (tblTable1) with two fields :

Name
Phone Number

AAAAA 12345
BBBBBB 36549
CCCC 12345
DDDDD 56987
....

Names are unique and but phone number are not.

User should be able to select the appropriate row from tblTable1 thru
combox box based on the Name or on the Phone number.

For this, I have two combox on the form. The Row Source from the first combo
box is a query to display the username followed by the phone number from
TblTable1. And the Row Source of the second combo si a query that display the
same information as before, but the first column is the phone number followed
by the user name. So, the user can select the row etiher by the name or the
phone selecting approproate combox box.

I'm not sure that this is the best option. is Combox boxes the best option ?

How can I synchronise both combo box ? what would be the best option to let
users select the appropriate row in a fast way ? I want to avoid to have
"Search" button command.
 
R

Ron2005

The two dropdowns seem to be fine and should work. The question would
be what do you mean by synchronise.

Perhaps a better option would be to have a sub form also on the form
that showed both fields, However create two more queries

SubQueryA would have a condition of the name = namecombo
SubQueryB would have a condition of the Phone = PhoneCombo

In the after update condition of the namecombo then change the subform
rowsource to be subqueryA and do a requery.
In the afterupdate condition of the phonecombo then change the subform
rowsource to be subqueryB and do a requery.

If you try to do this (and it could be done) with the rowsources of the
combos then you would not be able to change your mind about which to
search on. You could change the rowsource of phonecombo when name combo
is selected but if it was the wrong name or you can't get the spelling
right you could not change your mind and search by phone instead
because only phones matching the name would now show. And ViseVersa....
You would have to have a reset button or something to reset the
rowsources back to the original queries.

Ron
 

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

Top