S
shaggles
I'm trying to add multiple records by looping through one
record set and using addnew on a second recordset using
the code below but I get a Sub or Function not defined
error when I run it. What am I doing wrong? Can I open 2
recordsets at once?
Private Sub Combo30_AfterUpdate()
Dim db As DAO.Database
Dim rst1, rst2 As DAO.Recordset
Set db = CurrentDb
Set rst1 = db.OpenRecordset("SELECT tblUsers.DeptID,
tblUsers.User_Name " & _
"FROM tblUsers INNER JOIN
tblGroups on " & _
"tblUsers.UserID=tblGroups.User
ID " & _
"WHERE tblGroups.Group_Name="
& "'" & Me!Group & "'")
Set rst2 = db.OpenRecordset("tblResponse", dbOpenDynaset)
While Not rst1.EOF
rst2.AddNew
rst2("DeptID") = DeptID
rst2.Update
MoveNext
End Sub
record set and using addnew on a second recordset using
the code below but I get a Sub or Function not defined
error when I run it. What am I doing wrong? Can I open 2
recordsets at once?
Private Sub Combo30_AfterUpdate()
Dim db As DAO.Database
Dim rst1, rst2 As DAO.Recordset
Set db = CurrentDb
Set rst1 = db.OpenRecordset("SELECT tblUsers.DeptID,
tblUsers.User_Name " & _
"FROM tblUsers INNER JOIN
tblGroups on " & _
"tblUsers.UserID=tblGroups.User
ID " & _
"WHERE tblGroups.Group_Name="
& "'" & Me!Group & "'")
Set rst2 = db.OpenRecordset("tblResponse", dbOpenDynaset)
While Not rst1.EOF
rst2.AddNew
rst2("DeptID") = DeptID
rst2.Update
MoveNext
End Sub