Results 1 to 2 of 2
  1. #1
    hsusmani is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Feb 2016
    Posts
    1

    display text in text box depending on the combo box which in turn is dependant on another combo box

    Hello everyone,


    I am new to Access and trying to do this.
    I have got two combo boxes. One is dependant on another one. They two are working fine. Now I am trying to add a text field which is for prices. If the second combo box selects any option, the adjacent price should appear in this text box which is not happening with simple coding like linking two columns together and then selecting second column and so on. This step works but only when combox box 2 is left untouched. Otherwise if choice is made in combo box 2, text field goes empty.


    Here is my code for the dependant combo box (the second one):
    This code is just to show what has been done to combo box 2.


    Private Sub cmbres_AfterUpdate()
    Dim strSource As String
    strSource = "SELECT Item" & _
    "FROM TBL_items " & _
    "WHERE RestaurantName = '" & Me.cmbres & "' ORDER BY Branch"
    Me.itm1.RowSource = strSource
    End Sub
    "Item"=column inside "TBL_items" table, "RestaurantName" another column. "cmbres" is this combo box (1st one) and "itm1" is the second one where it shows specific choices to choose.


    I am looking for help! Thanks in advance

  2. #2
    nhorton79 is offline Advanced Beginner
    Windows 8 Access 2007
    Join Date
    Apr 2015
    Posts
    34
    I'm just learning too but have been doing something like this myself.

    What I did was one the second combobox "itm1" was have the row source also select the price:
    SELECT Item,Price FROM tbl_items etc

    Then I set the textbox source to be:
    Me!itm1.column(1)
    Column 1 is actually the second column (starts from 0).

    Hope this works for you

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 03-09-2015, 12:03 PM
  2. Replies: 11
    Last Post: 02-20-2015, 10:45 AM
  3. Replies: 5
    Last Post: 08-08-2012, 01:30 PM
  4. Replies: 10
    Last Post: 03-22-2012, 07:00 PM
  5. Replies: 2
    Last Post: 10-09-2009, 07:34 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums