How do I Display values of combo box in text box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jerry Maiapu
    Contributor
    • Feb 2010
    • 259

    How do I Display values of combo box in text box

    Can Someone help me.

    I have the follwing on a form:
    name:
    1. a combo box = txtselectname
    2. text box = txtfullname

    the ombo box has a sql select query as its row source.
    ............... ............... ............... ...............
    SELECT [Employees].[EmployeeID], [Employees].[FirstName], [Employees].[LastName] FROM [Employees] ORDER BY [FirstName];
    ............... ............... ............... ............... ............

    when scrolled to see values it displays both surname and first name which is okay and when selected It display only the first name. .....ok as well

    My problem is:

    I want to display both the first name and second name in the combo box on a text box called txtfullname so on after update of the combo box I did the following
    ............... ............... ............... ............... ............
    Private Sub txtselectname_A fterUpdate()
    txtfullname = Me!txtselectnam e
    End Sub
    ............... ............... ............... ............... ..............

    but it shows only the EmployeeID number instead of First name and last name as shown in combo box.

    Question

    How do I make the selected names (first name and surname) from the combo box appear in the text box using afterupdate event of the combo box?
    Please someone help

    Desperate.. beginner

    Jerry Maiapu
  • Kinwang2009
    New Member
    • Feb 2010
    • 22

    #2
    Hi Jerry Maiapu,
    I think you are talking about MS Access if so then use my below code.
    txtfullname = txtselectname.C olumn(0) & " " & txtselectname.C olumn(1)
    Hope this helps.

    Comment

    • Jerry Maiapu
      Contributor
      • Feb 2010
      • 259

      #3
      Thanks so much you are best..

      Comment

      Working...