Sandra Smith
asked on
Set a variable to the one field in a recordset object
This is the start of a complicated email, but I am taking it in steps. I have begun with the outer most loop in that I need to get all the TaskID's from a query, but how to I assign each TaskID to the variable for the loop? that is, each time through the outside loop, I want to use the TaskID and then move to the next TaskID and use that for the next loop.
Private Sub cmdGenerate_Click()
'Generate final email to manager
Dim strUpdateHistory As String
Dim strUpdateCurrent As String
Dim strUpdateTitle As String
Dim qdfUpdateHistory As QueryDef
Dim qdfUpdateCurrent As QueryDef
Dim qdfUpdateTitle As QueryDef
Dim strTaskID As String
Set rst = CurrentDb.OpenRecordset("Select TaskID from qryTasks_UpdatesEmail")
'HOW TO SET THE VARIABLE TO THE TASKID FROM THIS SELECT QUERY
With rst
Do While Not .EOF
Set qdfUpdateTitle = CurrentDb.CreateQueryDef("qryUpdateTitle", strUpdateTitle)
DoCmd.OpenQuery "qryUpdateTitle"
DoCmd.Close acQuery, "qryUpdateTitle"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER