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

get a value from a field in a query and store it in a variable 2

Status
Not open for further replies.

act2

Technical User
Dec 17, 2005
34
US
I’m trying to get a value from a field in a query and store it in a variable using VB. I’ve tried many suggestions from the post but noting seems to work. The query is called qryReportGen and the field within the query is JobHr . Thanks
 
Have a look at the DLookUp function or at Recordset.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Like PHV said. Something like
Dim intJobHr as integer
dim strWhere as string
strWhere = "something here"
intJobHr = dlookup("JobHr","qryReportGen",strWhere)

The strWhere is a where statement without the word "where" in it. Maybe something like

strWhere = "JobID = " & me.txtBoxJobID
 
PHV and MajP thanks for your help. Worked great
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top