Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can anyone help with Dlookup? 4

Status
Not open for further replies.

vince99

IS-IT--Management
Mar 1, 2001
63
0
0
US
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...

PaulF
 
Ok, I have done that. But when I enter the

txtPrice = combo.column(1) nothing happens.

What I did was is reference the combo.coloumn(1)

in the text box where I wanted the info displayed.

That works fine. The problem I am having is that the

value will not store itself on the main table that the

form points to. Can you help?


 
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
 
I have the same problem too, however, I'm using it in a subform. I've tried

Me.FieldName = DLookup("FieldName", "Table", ComboBox = [FORMS]![RQLetter]![RQSubform]![ComboBox])

and

using a macro to requery the FieldName.

It used to work but now it's not. :-(

What else can I do?
 
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] & "'")

PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top