i'm trying to use dlookup to look up the price of a product based on a combo box selection. here's the expression I have so far but it doesn't seem to be working
Common sense dictates that a field named [Product Name] is, in fact, Text, so Ranman256's syntax should work...assuming that [Product Name] is the Bound Column for the Combobox, which may or may not be true! When using the Combobox Wizard, the Access Gnomes will add the PK from the underlying Table, even if the developer doesn't include it, and then proceed to make it the Bound Column!
If Ranman256's code doesn't work for you, add this in your code window:
Code:
Private Sub combo12_AfterUpdate()
MsgBox Me.combo12
End Sub
Now make a selection from the Combobox...does the Messagebox display the [Product Name] or something else?
i tried this but it comes up with #name?
=DLookUp([Price],[Stock],"[Price]='" & [cboBox] & "'products") is the code I used, 'products' is what I re-named the combo box
Common sense dictates that a field named [Product Name] is, in fact, Text, so Ranman256's syntax should work...assuming that [Product Name] is the Bound Column for the Combobox, which may or may not be true! When using the Combobox Wizard, the Access Gnomes will add the PK from the underlying Table, even if the developer doesn't include it, and then proceed to make it the Bound Column!
If Ranman256's code doesn't work for you, add this in your code window:
Code:
Private Sub combo12_AfterUpdate()
MsgBox Me.combo12
End Sub
Now make a selection from the Combobox...does the Messagebox display the [Product Name] or something else?