By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,124 Members | 2,208 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,124 IT Pros & Developers. It's quick & easy.

sync two boxes

100+
P: 158
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!
Aug 21 '08 #1
Share this Question
Share on Google+
5 Replies


puppydogbuddy
Expert 100+
P: 1,923
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourCombo_AfterUpdate()
  2.  
  3. Me!YourTextbox.Value = Me!YourCombobox.Column(1)
  4.  
  5. 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......
Aug 21 '08 #2

100+
P: 158
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourCombo_AfterUpdate()
  2.  
  3. Me!YourTextbox.Value = Me!YourCombobox.Column(1)
  4.  
  5. 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 Images
File Type: jpg example.JPG (53.7 KB, 123 views)
Aug 21 '08 #3

missinglinq
Expert 2.5K+
P: 3,532
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)>
Aug 21 '08 #4

100+
P: 158
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.
Aug 22 '08 #5

puppydogbuddy
Expert 100+
P: 1,923
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.
Aug 23 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.