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

Query results assigned to a variable

Status
Not open for further replies.

ajaeger

Technical User
Feb 6, 2003
201
US
I can't seem to find what I'm looking for. Maybe I'm looking for the wrong words or it's just too late...

Let's say I have the following table named 'Participants'
ID RegistrationID
100 3948
101 3847

I have the following select statement in code:

strSQL = "Select RegistrationID from Participants where ID = 100"

I need to set another variable, strRegID, so that it is equal to the results of this query - '3948'

Simple I'm sure, I'm just having a mental blank tonight.

Thank you

Anna Jaeger
iMIS Database Support
 
You would need to use the SQL to create a recordset, but if you do not intend manipulating the data, and if ID is unique, DlookUp is probably more suitable:

[tt]strRegID=DlookUp("RegistrationID","Participants","ID = " & lngID)[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top