combo box question

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

Guest

I am trying to set up a form so that by entering one field, the remaining fields are populated. Meaning, using a combo box, if the company name is selected, then the address information comes up in the other fields.
 
I am trying to set up a form so that by entering one field, the
remaining fields are populated. Meaning, using a combo box, if the
company name is selected, then the address information comes up in
the other fields.

Use the Combo Box wizard to add a new combo box the form.
If you select the third option on the first page of questions,
(something like 'Find a record '.... etc.) Access will set this all up
for you.
 
You have to change the RowSource for your comboBox to
include all the information that you wish to place into the
other controls. You also have to change the column count
accordingly.

Then in the bomboBox's AfterUpdate event handler, you can
populate the other controls by using the comboBox's Column
property. This is a zero based index.

So your code will look something like

Private Sub {yourComboBox}.AfterUpdate()
{yourControl1}.Value = {yourComboBox}.Column(1)
{yourControl2}.Value = {yourComboBox}.Column(2)
etc
End Sub

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
I am trying to set up a form so that by entering one
field, the remaining fields are populated. Meaning, using
a combo box, if the company name is selected, then the
address information comes up in the other fields.
 
Hi Gerald,
Questions:
Does "{yourControl1}" refer to the first control after the initial combo box? I am asking because the first column is aleady used in teh first combo box. Based on that, shouldn't teh event start with column 2?. Also, what in what format should other fields (to be populated) be set? As combo boxes? Text? et

-Adam
 
Adam

{yourControl1} was my notation as I do not know what names
you have given the controls that you wish to populate.
Similarly, the column numbers I used were only to show you
the syntax. When you code this yourself, you will know
which columns are appropriate by looking at the RowSource SQL.

As to which type of control is appropriate for showing this
information, that depends upon what you are wanting to do
with it. Text Boxes are probably the safest bet but if you
don't want the users to change these values, it may be as
well to set their Enabled property to No.

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
Hi Gerald,
Questions:
Does "{yourControl1}" refer to the first control after the
initial combo box? I am asking because the first column is
aleady used in teh first combo box. Based on that,
shouldn't teh event start with column 2?. Also, what in
what format should other fields (to be populated) be set?
As combo boxes? Text? etc
 
Back
Top