Form with an unbound combo box.

  • Thread starter JOSELUIS via AccessMonster.com
  • Start date
J

JOSELUIS via AccessMonster.com

I´m trying to create a database but I take some examples from Inside Out 2007
by Viescas.I create a tblTeams ( TeamID,TeamName) tblPlayers(PlayerID) and
tblTeamPlayers(TeamID,TeamName,PlayerID). I create a form based on qryplayers
and I need a combobox "unbound?" called TeamName based on qlkqTeams but
when I try to open the combobox always shows the TeamID instead of TeamName.

In the sample database "Contacts" from Viescas the CompanyName is display
in the combobox CompanyID. I don´t really Know how this happen.Can anybody
give me an idea of how this works? Thanks
 
J

John W. Vinson

In the sample database "Contacts" from Viescas the CompanyName is display
in the combobox CompanyID. I don´t really Know how this happen.Can anybody
give me an idea of how this works? Thanks

A Combo will display the first *non zero width* column in its rowsource.

The RowSource is where the combo gets its data from. This is typically a
Query; it can have many (up to ten, I believe) fields.

The ColumnCount property specifies how many of those columns are available.

The Bound Column defines which of the fields will become the combo's value
when a selection is made.

The Control Source is the name of the table field into which that value will
be stored (this can be blank, if the purpose of the combo is other than
storing a value in a table).

The ColumnWidths is a string of numbers separated by semicolons, defining the
display width of each column; if a column is of zero width, it's part of the
combo but not shown to the user.

For example, you could have a RowSource query like

SELECT CustomerID, LastName & ", " & FirstName AS CustName, CustAddr,
CustPhone, LastName, FirstName FROM Customers ORDER BY LastName, FirstName;

If the combo has ColumnCount = 4 only the ID, full name, address and phone
will be included in the combo's data.

The Bound Column would be 1 - so that the ID will be stored.

If the ColumnWidths property is

0";1";1.5";.5"

the user will see the customer's name when the combo is not dropped down (e.g.
"Vinson, John", and the address and phone will be after it when it is dropped
down. The CustomerID will not show because its width is zero.
 
J

JOSELUIS via AccessMonster.com

Thank you vey much for your help. You really do it simple and clear so thank
you very much from Spain.
 

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