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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select statement

Status
Not open for further replies.

shaz123

Technical User
Oct 13, 2006
60
DE

How do u get a msgbox to show the results of an select statement, For instance below im a trying to show the results of a Select statement called StrSQ2, but this show the actual Select statement and no the result i was hoping.

MsgBox "The Cylinder Serial Number for the inputed barcode No is = '" & StrSQ2 & "'"

My SQL statement
StrSQ2 = "SELECT Cylinder Serial Number FROM [tbl_CylinderMasterclient] WHERE [Cylinder Barcode Label] = '" & Stringy & "'"

The Select statement is trying to look up the cylinder serial number were the cylinder barcode lable is equal to the value inputted into an input box
 
Have a look at the DLookUp function:
StrSQ2 = DLookUp("[Cylinder Serial Number]", "tbl_CylinderMasterclient", "[Cylinder Barcode Label]='" & Stringy & "'")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PHV
Thanx for that that works, the next bit was to be able to
input that Cylinder serial number picked up into a table.
How would i refer to the result of the Dlookup function, when trying to do this.

For instance RS! is refering to the field name within the table, but StrSQ2 is not reconigsed. Would i need to but a text box on the form with the result of the select statement and then send this infomration to the table?

rs![Cylinder Serial Number] = StrSQ2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top