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!

SQL Value

Status
Not open for further replies.

Dodge

IS-IT--Management
Jun 14, 2001
25
0
0
US
Hi,

Here's another brainbuster form an anoying newbie ;)

How do I run a query and have it store the value in a variable?

For instance:

LocationStr = "SELECT [Location] FROM [dbo.Users] WHERE [Badge#] = '" & UserHolder & "'"

Well I want LocationStr to remember the value that the query returns not the query. I've tried to use the DoCmd.RunSQL, but no go.

Any suggestions?

Thanks
Dodge
 
Use a DLookup rather than SQL to store the value like this:

LocationStr = DLookup("[Location]","dbo.Users","[Badge#]='" & UserHolder &"'")

HTH Joe Miller
joe.miller@flotech.net
 
Thanks, Worked like a champ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top