ComboBox Question

J

Johnny

Hello Everyone

I'm trying to populate a combobox with the value of some fields of the
same record, and can´t get the solution.
Need some help:
Ex:
Table Costumers
CostumerID
Name
Phone1
Phone2
Phone3

I need a combo box to show the phone numbers of a certain CostumerID
in drop down way in order to select one.
Any help please
Tks
 
G

Golfinray

Let the wizard put in your combo and select whatever you want it to pick. The
right click on the combo and go to properties. Go to events, then the
afterupdate event. Click on the little button out to the right and start the
code builder. Type:
Me.combo = "[yourfield] = """ & Me.combo# and """"
me.filteron = true
The combo# will be listed, like combo1 or combo22
 
P

PIRULI

Hello Everyone

I'm trying to populate a combobox with the value of some fields of the
same record, and can´t get the solution.
Need some help:
Ex:
Table Costumers
CostumerID
Name
Phone1
Phone2
Phone3

I need a combo box to show the phone numbers of a certain CostumerID
in drop down way in order to select one.
Any help please
Tks
 
J

Johnny

Hello Golfinray

Thnkyou for your answer, but i think i didn't explain myself verywell!

I have Costumers table like this:

CostumerID Name Phone1 Phone2 Phone3
12 Smith 14567 34596 56978

I want I combo that pick the phone numbers from this table and show
them like this:
14567
34596
56978

That will allow me to pick one number from combo.
tks
 
J

John Spencer

Well, you will need a Union query as the source

SELECT CustomerID, Phone1
FROM CustomersTable
WHERE Phone1 is Not Null

UNION All
SELECT CustomerID, Phone2
FROM CustomersTable
WHERE Phone2 is Not Null

UNION ALL
SELECT CustomerID, Phone2
FROM CustomersTable
WHERE Phone3 is Not Null


Save that query and use it as if it were a table

Your combobox source would be

SELECT CustomerID, Phone1
FROM qSavedUNIONQuery
WHERE CustomerID = 12

The customerID would need to change as the customer changes.


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

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