setting up a combo box

W

winty03

I am having a probelm with a combo box in a form. I have created a
form for a certian table.in this form I have a combo box drop down....I
have selected the table for the drop down but it is grabbing or using
the first field in the table which is an auto number, and I want it to
use the next field ..field 2 that has names in it. How can I tell the
combo to use the 2nd field in that table versus the first. Thanks Chris
 
R

ruralguy via AccessMonster.com

The answer to your question is change the bound column of the ComboBox. It is
on the Data tab of the properties sheet for the ComboBox and is 0 based.

I suspect you have a design issue if you are putting the same text in more
than one table. You may wish to review normalization.
 
A

Al Campagna

Chris,
Sounds like you've asked the combo to use the Table as the RowSource...
Select Query instead, and using the query design grid... set up the fields you want in
the colums you want.

But... say your selecting a Customer for a transaction of some sort. You shouldn't
capture the "CustName", you should capture the CustID (unique key for each Customer.
Duplicate names can exist, so your heading for problems eventually.
The table your using to gather this data should have a CustID field, and your combo
should be bound to that field.

Setup the combo (ex. name = cboCustID) this way.
ControlSource = CustID
Col1 = CustID, Col2 = CustName
NumberOfCols = 2
ColumnWidths = 0"; 2" (hides the CustID from the user)
ListWidth = 2"

Okay, here's what happens...
The combo just "displays" all the CustNames, the user selects a CustName, the combo
"displays" that name... but in reality, CustID is stored in your form table in the CustID
field. This does double duty... easy for the user to select a name, but really capture
the CustID... which is the key value that will allow you to always relate the data your
capturing back to "one and only one" Customer.

--
hth
Al Campagna
Candia Computer Consulting
Microsoft Access MVP - Candia, NH USA
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
W

winty03

Ok I tried the first idea, which was to stick in SELECT
RequestingAgency FROM tblRequestingAgency into the combo box row source
box. In the tblRequestingAgency table I have RequestingAgencyID which
is an autonumber and RequestingAgency which is the name of the agency.
I want this combo I have on a form to popular its drop down with the
agencys names, instead of the Autonumber. First idea didn't seem to
work. Any more?
 
A

Al Campagna

RequestingAgency FROM tblRequestingAgency
in the combo RowSource is not legitimate SQL statement.
Select Table/Query for the RowSourceType, place your cusor in the RowSource, and click
the 3dot button on the right.
You are now in Query design mode where you can select the table and fields you want to
populate the combo.
*See my January 08, 2007 1:34 PM response for further instructions...

--
hth
Al Campagna
Candia Computer Consulting
Microsoft Access MVP - Candia, NH USA
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 

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

Similar Threads


Top