Assigning the value of select SQL statements to variables

K

Kevin

Is it possible to assign the value of select sql
statements to variables? I see the "runSQL" method is
available for action queries, but I dont see how to assing
the value of select sql queries to variables in my
conditional if...then...else statements

Thanks in advace--again
 
G

Guest

Use "Recordsets", see help.

I am not sure exactly what you want to accompish
but something like this...

Dim rstEmployees As Recordset

RecordSetSource = "Select * FROM tblEmployees"
Set rstEmployees = CurrentDb.OpenRecordset
(RecordSetSource, dbOpenForwardOnly)
Do While Not rstEmployees.EOF
MsgBox rstEmployees!EmployeeName
MsgBox rstEmployees!EmployeeAddress
'
rstEmployees.MoveNext
Loop
rstEmployees.Close

There is a lot to do with Recordsets, so see help..
Also note there is ADO, DAO, again see help

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top