have a form with a few fields I want auto field. I would like to pull the
data from a table that I have set up. Right now im using this code in the
after update to fill in the field.
If Left(Me.Technician, 3) = "Don" Then Me.TECHNICIAN_PHONE = "354"
ElseIf Left(Me.Technician, 3) = "Bob" Then Me.TECHNICIAN_PHONE = "352"
ElseIf Left(Me.Technician, 3) = "Dan" Then Me.TECHNICIAN_PHONE = "354"
ElseIf Left(Me.Technician, 3) = "Phi" Then Me.TECHNICIAN_PHONE = "352"
End If
I have a table named "Technicians" that have both fields for
TECHNICIAN_Phone and TECHNICIAN_EMAIL. I would like those to be entered into
the TECHNICIAN_PHONE and TECHNICIAN_EMAIL in the form. The TECHNICIAN is a
drop down box that selects a name from the TECNICIAN table.
Donald,
Make your cboTechnician combobox a 3 column combo, by adding a
TechnicianPhone and a TechnicianEmail column to your combo query.
On the AfterUpdate event of combo cboTechnician, use this code...
[TechPhone] = [cboTechnician].Column(1)
[TechEmail] = [cboTechnician].Column(2)
(combo box columns are numbered 0,1,2,3, etc..)
Whenever cboTechnician is Updated, the two text controls are updated also.
hth
Al Camp
> have a form with a few fields I want auto field. I would like to pull the
> data from a table that I have set up. Right now im using this code in the
[quoted text clipped - 11 lines]
> the TECHNICIAN_PHONE and TECHNICIAN_EMAIL in the form. The TECHNICIAN is a
> drop down box that selects a name from the TECNICIAN table.
Donald - 03 Mar 2005 15:31 GMT
Thanks,
That worked for the TechPhone. But for some reason TechEmail stays blank.
> Donald,
> Make your cboTechnician combobox a 3 column combo, by adding a
[quoted text clipped - 22 lines]
> > the TECHNICIAN_PHONE and TECHNICIAN_EMAIL in the form. The TECHNICIAN is a
> > drop down box that selects a name from the TECNICIAN table.
Van T. Dinh - 03 Mar 2005 22:19 GMT
Have you checked the RowSource and the ColumnCount of the ComboBox?
The ColumnCount needs to cover all Columns you want to use. For example,
the ColumnCount must be at least 3 in the posted code.

Signature
HTH
Van T. Dinh
MVP (Access)
> Thanks,
>
[quoted text clipped - 26 lines]
> > > the TECHNICIAN_PHONE and TECHNICIAN_EMAIL in the form. The TECHNICIAN is a
> > > drop down box that selects a name from the TECNICIAN table.
Donald - 08 Mar 2005 15:21 GMT
Columncount fixed it. Thanks guys.
> Have you checked the RowSource and the ColumnCount of the ComboBox?
>
[quoted text clipped - 37 lines]
> is a
> > > > drop down box that selects a name from the TECNICIAN table.