Msgbox code

shaz123

Registered User.
Local time
Today, 11:42
Joined
Sep 8, 2006
Messages
81
StrSQ3 = Dlookup("[R Status]", "tbl_TransactionMasterclient", "[Cylinder Barcode Label]='" & Stringy & "' AND [Time of Transaction]=#" _
& DMax("[Time of Transaction]", "tbl_TransactionMasterclient", "[Cylinder Barcode Label] = '" & Stringy & "'") & "#")

I wanted to test if the above wrks, how would i display the result in the message box when i have declared StrSQ3 as a variant
 
Have you examined StrSQ3 in the immediate window to see if it works?
 
Msgbox

Immediate window?

when i do run the code, an error message shoulld of appeared to say thecylinder is already in use, but instead this message does not appear. thats why i need to test if the correct informatio is being picked up
 
The immediate window is a debug tool in the code editor - If you have trouble finding documentation on it I'll try to find something online...
 
shaz123 said:
Immediate window?

when i do run the code, an error message shoulld of appeared to say thecylinder is already in use, but instead this message does not appear. thats why i need to test if the correct informatio is being picked up

As Ken says, you should use the Immediate window which allows you to see the value of variables etc as you run the code.

Its very easy to use. In the VBA editor, press Ctrl-G to display the Immediate window. Then in your code after the point where you assign StrSQ3 type:
debug.print StrSQ3

When the code runs it will output the value of StrSQ3 to the Immediate window and you can examine the result at your leisure.

The Immediate window can be used in other ways but this will do what you need.

If you really want to use the message box then:
MsgBox ("the value is " & StrSQ3)

hth
Stopher
 

Users who are viewing this thread

Back
Top Bottom