message box with D look up

S

Simon

i have a product list form that i want a click button that will load
up a message box displaying stock level

What code would i use to do this

DLookup("[StockLevel]", "qryStock", "[ProductID]=" & Me.ProductID)

Message box
Stock level is ????

OK button


Can some one point me in right direction
 
J

John Spencer

MsgBox "Stock Level is " & _
DLookup("StockLevel", "qryStock", "ProductID=" & Me.ProductID)

If ProductID is a text field and not a number field then you need a slight
modification.
MsgBox "Stock Level is " & _
DLookup("StockLevel", "qryStock", "ProductID=""" & Me.ProductID & """")

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top