form design

  • Thread starter He cries for help
  • Start date
H

He cries for help

I have created a form with 4 text fields I will call a,b,c,d, for brevity
sake. I have also imported a table from excel with the identical column
headers of a,b,c,d. I would like to know if there is a way to create a combo
box (or other means) to select a field (a)from the imported table and it will
automatically fill in the balance of the text fields (b,c,d) on the form with
data from the table.

I have been stumped by this problem for weeks.
 
A

Arvin Meyer [MVP]

To be sure I have your request correct, you want to select a value from
column a and have all the corresponding values on the row displayed in
separate text boxes. Is the correct. Piece of cake assuming that the values
in column a are unique:

1. Create a blank combo, make sure the rowsourcetype is a Table or Query,
and the rowsource reads something like:

Select * From tblExcel Order By a;

Now make sure the bound column is column 1, and the column count is 4. Set
the column widths to:

1";0";0";0"

Now, all you'll see in the combo is the values in column a. You may need to
increase the column width of the first column more than 1" to see the data.

Column a is the first column and its index is 0, likewise Column b is the
second column and its index is 1, etc. So now, set the coltrolSource of each
of your 3 textboxes to:

= cboComboName1.Column(1)
= cboComboName1.Column(2)
= cboComboName1.Column(3)

and you're done. See? I told you it was easy.
 
Top