Dlookup turn -1 or 0 into a word

S

Simon

I have a message box that displays if a product is 'Stocked' or 'Not
STocked' but in the databse its stored as -1 or 0

I use the follwoing code
DLookup("StockedItem", "tblProduct", "ProductID=" & Me.ProductID)

So in the message box at the moment it says -1 or 0, how do i code it
to says 'stocked' if -1 and 'Not STocked' if 0

Thanks
 
A

Arvin Meyer [MVP]

Assuming ever field has a value:

If Stocked = -1 Then
MsgBox "Stocked", vbOKOnly
Else
MsgBox "Not Stocked", vbOKOnly
End If
 
D

David W. Fenton

m:
I use the follwoing code
DLookup("StockedItem", "tblProduct", "ProductID=" & Me.ProductID)

So in the message box at the moment it says -1 or 0, how do i code
it to says 'stocked' if -1 and 'Not STocked' if 0

Dim bolStock As Boolean

bolStock = DLookup("StockedItem", "tblProduct", "ProductID=" _
& Me.ProductID)
Debug.Print Format(bolStock,"\Sto\cke\d/\Not \Sto\cke\d")

The escapes (i.e., backslash character) are necessary for all
literal characters that have pre-defined meaning to format
(s=second, c=a particular date format, d=day).
 

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

Similar Threads


Top