|
tech
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Auto fill a boxhave 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 Show quote "Donald" <Don***@discussions.microsoft.com> wrote in message news:A67373DE-C3CF-440C-8DB3-3F565B77B00D@microsoft.com... > 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. Thanks,
That worked for the TechPhone. But for some reason TechEmail stays blank. Show quote "AlCamp" wrote: > 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 > > "Donald" <Don***@discussions.microsoft.com> wrote in message > news:A67373DE-C3CF-440C-8DB3-3F565B77B00D@microsoft.com... > > 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. > > > 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. -- Show quoteHTH Van T. Dinh MVP (Access) "Donald" <Don***@discussions.microsoft.com> wrote in message news:00465493-A33F-4616-A1D9-959FD3B85298@microsoft.com... > Thanks, > > That worked for the TechPhone. But for some reason TechEmail stays blank. > > "AlCamp" wrote: > > > 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 > > > > "Donald" <Don***@discussions.microsoft.com> wrote in message > > news:A67373DE-C3CF-440C-8DB3-3F565B77B00D@microsoft.com... > > > 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. > > > > > > Columncount fixed it. Thanks guys.
Show quote "Van T. Dinh" wrote: > 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. > > -- > HTH > Van T. Dinh > MVP (Access) > > > "Donald" <Don***@discussions.microsoft.com> wrote in message > news:00465493-A33F-4616-A1D9-959FD3B85298@microsoft.com... > > Thanks, > > > > That worked for the TechPhone. But for some reason TechEmail stays > blank. > > > > "AlCamp" wrote: > > > > > 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 > > > > > > "Donald" <Don***@discussions.microsoft.com> wrote in message > > > news:A67373DE-C3CF-440C-8DB3-3F565B77B00D@microsoft.com... > > > > 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. > > > > > > > > > > > > |
|||||||||||||||||||||||