Having a brain freeze

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

Guest

I have a form that has several subforms. The header of the form will contain
the information concerning the location:

TF Number
TF Site Name
TF Customer Number

These are all fields in tbl TF Profile

I want to be able to select the TF Number in the first field of the form and
have the site name and customer number automatically fill in for the other 2
fields.

I've done this before (a long time ago) and can't remember how I did it.

Any help would be apprecitated.

Linda
 
Easiest approach would be to use a combo box for TF Number. Have a query
that returns all three fields as the row source for that combo box. It's not
necessary to have the other two fields visible if you don't want to.

In the combo box's AfterUpdate event, put code like:

Private Sub cboTFNumber_AfterUpdate()

Me.txtTFSiteName = Me.cboTFNumber.Column(1)
Me.txtTFCustomberNumber = Me.cboTFNumber.Column(2)

End Sub

Note that the Column collection starts numbering at 0: it's Column(1) for TF
Site Name because that's the 2nd column.
 
Ok, that didn't work. Perhaps I didn't explain it properly.

My table has 10 fields.

I used the Lookup Wizard for the first field. TF Number
I then created a form using the form wizard, utilizing all the fields from
the table. I can select the TF Number from the drop down list. What I am
looking for now is for the TF Site Name and TF Customer Number fields to
automatically populate with the correct Name and Customer number for the TF
that I selected.

Again, any help is appreciated.
 
The answer was correct. To fill in other fields based on one selection, you
can use the column option from a query used in the first field. The column
widths in the first field property for the additional fields can be set to 0"
(not visible) and this technique will work. Column count on the first field,
in this example, would be set to 3. The example used Visual Basic to set the
values, you could use a Macro of two lines - the Action = SetValue, the
variables would be the two controls, the expressions would be
TFNumber.Column(1) and TFNumber.Column(2).
 
Back
Top