Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Dec 2002
    Location
    New Orleans, Louisiana, USA
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo box to fill in bound text box (Access2000)

    Hi everyone,
    What happened to search? I always forget how to get the combo box to fill in the next field and someone (I think Hans) had answered it. I printed it out but I can't find it.
    Anyway, here is my question. I have a combo box for CounseledByEmployee that uses the row source SELECT [L_Employees].[ID], [L_Employees].[CounseledByEmployee], [L_Employees].[CounseledByDept] FROM L_Employees ORDER BY [L_Employees].[CounseledByEmployee]; After I select an employee, I want the next field, Dept, to be filled in automatically. I thought it was just a simple matter of an AfterUpdate event but that's not working. Here' s my AfterUpdateEvent:
    Private Sub
    CounseledBy_AfterUpdate()
    Me![CounseledByEmployee] = Me![L_Employees].Column(2)
    Me![CounseledByDept] = Me![L_Employees].Column(3)
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo box to fill in bound text box (Access2000)

    Search has been disabled for almost four months now - see <!post=Temporary suspension of Search facility,250092>Temporary suspension of Search facility<!/post>.

    Columns in a list box or combo box are numbered starting at zero: 0, 1, 2, ... So CounseledByEmployee is Column(1), and CounseledByDept is Column(2). See if this works first; if it doesn't help, there are some other things you can try.

  3. #3
    Star Lounger
    Join Date
    Dec 2002
    Location
    New Orleans, Louisiana, USA
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo box to fill in bound text box (Access2000)

    Didn't help. The CounseledByEmployee field has worked all along but nothing goes into the Dept. text box. It seems like last time it had something to do with what my text box was named.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo box to fill in bound text box (Access2000)

    Strange. To what field is the combo box bound? It should be bound to an ID field, and Bound Column should be 1.

    If you can't get it to work, try plan B. First make a copy of the form, or of the database, just in case...

    Create a query based on the table behind the form and on the lookup table L_Employees.
    Join them on the appropriate field, and make it into an outer join; the query should return all records from the table-behind-the-form.
    Add the fields you need from the table-behind-the-form, plus CounseledByEmployee and CounseledByDept from L_Employees.
    Close and save this query.
    Set the record source of the form to this query.
    Set the control source of the employee and department text boxes to CounseledByEmployee and CounseledByDept.
    Scrap the After Update code - you don't need it in this scenario.

  5. #5
    Star Lounger
    Join Date
    Dec 2002
    Location
    New Orleans, Louisiana, USA
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo box to fill in bound text box (Access2000)

    Neither plan worked. As a matter of fact, plan B made it worse. Couldn't select any name even though I could see the list. Now that I think of it, what do you mean the combo box should be bound to an ID field. Perhaps that is my problem. I have it bound to CounseledByEmployee but how do I bind it to the ID number? The ID number is only found in the L_Employees table. The CounseledByEmployee field is found in L_Employees and T_Patients. I'm completely lost now. I'll start again in the morning.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo box to fill in bound text box (Access2000)

    If the combo box is bound to CounseledByEmployee I don't understand what the purpose of the line

    Me![CounseledByEmployee] = Me![L_Employees].Column(2)

    in your original code was. But here is plan C: set the Bound Column property of the combo box to 2.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •