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

Refering to a query result as a string 1

Status
Not open for further replies.

RichyT

Technical User
Jun 11, 2002
20
GB
I wish to set a variable in VBA to equal an email address that is returned from an access query.

Can anyone please help?

Rich
 
Many options here are 2

dao
dim rst as recordset
txtvariable as string
set rst = currentdb.openrecordset("queryname")
rst.movefirst
txtvariable = rst!email
rst.close

dlookup
txtvariable = dlookup("email","queryname")
you will need to make sure the names fit you database and there is some error trapping but what you ask is common




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top