INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Combo Boxes

Comboboxes - Using Multiple Columns by KenReay
Posted: 9 Oct 03

A combo box may display several columns in its drop down list.

The number of columns visible in the combo box dropdown list is controlled by a combination of:

  • the .Columns property of the combo box


  • the width property for each column.


Columns with a width value of zero, are present and available in code, but are not visible to the user.

The columns are numbered from the left beginning at zero.

The value returned using =cboMyCombo is the value from column zero.

To return the values from other columns use =cboMyCombo.Column(1), =cboMyCombo.Column(2) ..etc

A common use for this is to allow the user to choose (say) a name from a combo box and to display the associated Address, to achieve this define a combo box as follows:

  • Name: CboName


  • Rowsource: SELECT lngId, strName, strAddress1, strAddress2, strAddress3 FROM tblPeople ORDER BY strName


  • Columns: 5


  • ColumnWidths: 0;4;4;4;4


Define four text boxes (txtAddess1, txtAddress2, txtAddress3, txtAddress4) with properties so:

  • Enabled: False


  • Locked: False


  • Set their ControlSource property so

       Control        ControlSource
       TxtAddress1            =cboMyCombo.Column(2)
       TxtAddress2            =cboMyCombo.Column(3)
       TxtAddress3            =cboMyCombo.Column(4)

    Now if you choose a name from the combo box dropdown list, the name will be shown in the combo box control, and the address will be displayed in the textbox controls.





Back to Microsoft: Access Forms FAQ Index
Back to Microsoft: Access Forms Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close