sync two boxes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jollywg
    New Member
    • Mar 2008
    • 158

    #1

    sync two boxes

    I have two drop down boxes. Both pull from the same table (tblItemMaster) . What i need it to do is when the user selects an item from the item dropdown box (ie bolts, screws etc) i need the description box to automatically display that description in the description drop down box. The only part that is working is "lookup" drop down box for parts.

    Any help is greatly appreciated!!

    Thanks!
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Originally posted by Jollywg
    I have two drop down boxes. Both pull from the same table (tblItemMaster) . What i need it to do is when the user selects an item from the item dropdown box (ie bolts, screws etc) i need the description box to automatically display that description in the description drop down box. The only part that is working is "lookup" drop down box for parts.

    Any help is greatly appreciated!!

    Thanks!
    1. Change your second dropdown box to a textbox. You don't need another lookup box for description because it is (should be) one of the columns in your first lookup box and just needs to be retrieved.
    2. Place the following code in the combobox's AfterUpdate event as shown:

    Code:
    Private Sub YourCombo_AfterUpdate()
    
    Me!YourTextbox.Value = Me!YourCombobox.Column(1)
    
    End Sub

    You need to replace the illustrative names (YourTextbox, YourCombobox) I used with the real names in your application. Column indexes start at 0...hence the reference to column(1)...I am assuming the description is in the second column of your combobox Column 1 is the second column.....0,1. .....

    Comment

    • Jollywg
      New Member
      • Mar 2008
      • 158

      #3
      Originally posted by puppydogbuddy
      1. Change your second dropdown box to a textbox. You don't need another lookup box for description because it is (should be) one of the columns in your first lookup box and just needs to be retrieved.
      2. Place the following code in the combobox's AfterUpdate event as shown:

      Code:
      Private Sub YourCombo_AfterUpdate()
      
      Me!YourTextbox.Value = Me!YourCombobox.Column(1)
      
      End Sub

      You need to replace the illustrative names (YourTextbox, YourCombobox) I used with the real names in your application. Column indexes start at 0...hence the reference to column(1)...I am assuming the description is in the second column of your combobox Column 1 is the second column.....0,1. .....

      That is almost exactly what i need. The only problem is that whenever i put in the item the description comes up (as it should). Then when i move to the next record which appears right below it (this is a subform) the item can be changed, but all the descriptions change with it.[/IMG]
      Attached Files

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        You don't have your description textbox bound to a field in the underlying table, and this is the normal behavior for unbound controls on continuous/datasheet forms. You'll have to have a field in the table for Description and enter it in the textbox's Control Source Property.

        Linq ;0)>

        Comment

        • Jollywg
          New Member
          • Mar 2008
          • 158

          #5
          Originally posted by missinglinq
          You don't have your description textbox bound to a field in the underlying table, and this is the normal behavior for unbound controls on continuous/datasheet forms. You'll have to have a field in the table for Description and enter it in the textbox's Control Source Property.

          Linq ;0)>

          Now in addition to updating the description i need to update the price. it is the 3rd column in the table, and i used the same line of code with the exception that i changed the (1) to a (2). It doesn't give me an error, but it doesn't display anything either.

          Comment

          • puppydogbuddy
            Recognized Expert Top Contributor
            • May 2007
            • 1923

            #6
            Originally posted by Jollywg
            Now in addition to updating the description i need to update the price. it is the 3rd column in the table, and i used the same line of code with the exception that i changed the (1) to a (2). It doesn't give me an error, but it doesn't display anything either.
            In order to reference the price as Column(2) in your combobox, it must be included as the third column in the combobox's row source table/query and must have a column width > 0 that fits in relation to the total width displayed for the combobox.

            Comment

            Working...