I have a drop down box that contains a list of products that we sell. When I select one of the products, I would like access to fill in the price box automaticly. What do I need to do this?
I wish to thank you in advance for any help oy suggestions.
the easiest way would be to add a column to the box that has the price, you can set this column's width to 0 so it won't show, then in the AfterUpdate event use something like this
txtPrice = cboProduct.Column(1)
Columns are 0 based, so the first column is Column(0), 2nd is Column(1) etc...
Make sure your txtPrice field is bound to the table (its control source.) Make sure column 1 is really a column with data in it i.e: your column count for the combobox agrees with the number of columns you have and the data you want is in the right column (of course not neglecting the zero based issue!) Gord
ghubbell@total.net
NiteLink, the above answer suggested not using DLookUp but to add another column to the ComboBox, and capture the value there. But if what you want to do is use DLookUp and base the results on an item selected in your ComboBox then change
Me.FieldName = DLookup("FieldName", "Table", ComboBox = [FORMS]![RQLetter]![RQSubform]![ComboBox])
To
Me.FieldName = DLookup("FieldName", "TableName", "ComboBox FieldName = '" & [FORMS]![RQLetter]![RQSubform]![ComboBox] & "'"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.