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

Need help returning values from database in vb code

Status
Not open for further replies.

ecomajor

Programmer
Sep 13, 2004
7
US
Hi,
I have a query (or a stored procedure) that I want to return an integer value from sql server into my vba code in access.
How do I go about executing the procedure (or the query) and then getting that integer value from it so that I can use it within my vba code?
 
If you use a query that only returns one row you can use the DLookup function like so.

Dim i As Integer
i = DLookup("FieldName", "QueryName")

if you want to filter out the row you want
Dim i As Integer
i = DLookup("FieldName", "QueryName", "Where clause without the Where")

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top