Getting all fields to be displayed in a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a data base that has several tables. In one form that I am
building, A have a combo box that pulls data from one table and places the
first field in the other table. Now on that form I would like the other 4
fields to display on the form from selecting from that single combo box. how
do I get that to happen? do I have to create a macro or create a module to
pull the other fields onto this form?
 
There are two ways to do this.

- Use the combo box' Column property. If the other fields are included as
columns in the combo box (they don't need to display in the drop-down
list--you can set their Column Widths to 0"), then you can refer to them with
the Column property and the column's index, beginning with zero. For
example, to set an unbound textbox to display the second column, set its
Control Source to:

=Me!YourComboBox.Column(1)

- Base the form on a query. Include the other fields you'd like to display
from the "lookup" table. Do NOT include its primary key; only the foreign
key in the main table. When you select from the list (entering the foreign
key), the other fields will display.

Hope that helps.
Sprinks
 
Is Me! the name of the unbound text box?

Sprinks said:
There are two ways to do this.

- Use the combo box' Column property. If the other fields are included as
columns in the combo box (they don't need to display in the drop-down
list--you can set their Column Widths to 0"), then you can refer to them with
the Column property and the column's index, beginning with zero. For
example, to set an unbound textbox to display the second column, set its
Control Source to:

=Me!YourComboBox.Column(1)

- Base the form on a query. Include the other fields you'd like to display
from the "lookup" table. Do NOT include its primary key; only the foreign
key in the main table. When you select from the list (entering the foreign
key), the other fields will display.

Hope that helps.
Sprinks
 
Me! is an Access-provided shortcut for the current form. For example, to
refer to a control named "cboCustomer" on a form named "Customers", the full
reference is:

Forms!Customers!cboCustomer

or preferably, including bracket delimiters, which you have to provide if
the names contained any spaces,

Forms![Customers]![cboCustomer]

If the control is on the current form, you can use the Me! shortcut:

Me![cboCustomer]

So, the complete specification of the 2nd column in a combo box named
cboCustomer on the current form is:

Me![cboCustomer].Column(1)

Hope that helps.
Sprinks
 
Thank you, that resolves the questions!!!

Sprinks said:
Me! is an Access-provided shortcut for the current form. For example, to
refer to a control named "cboCustomer" on a form named "Customers", the full
reference is:

Forms!Customers!cboCustomer

or preferably, including bracket delimiters, which you have to provide if
the names contained any spaces,

Forms![Customers]![cboCustomer]

If the control is on the current form, you can use the Me! shortcut:

Me![cboCustomer]

So, the complete specification of the 2nd column in a combo box named
cboCustomer on the current form is:

Me![cboCustomer].Column(1)

Hope that helps.
Sprinks


KA1oxd said:
Is Me! the name of the unbound text box?
 
Back
Top