S
shaggles
Is this possible? When I try to run the code below I get
an Oject Required error message.
Private Sub Command23_Click()
On Error GoTo Err_Command23_Click
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
If Me!Group Is Null Then
Set rst = db.OpenRecordset("SELECT * FROM (tblResponse
INNER JOIN tblUsers " & _
"ON tblResponse.DeptID=tblUsers.DeptID) " & _
"WHERE tblResponse.Issue_Num = " & Me!Issue_Num)
Else
Set rst = db.OpenRecordset("SELECT tblUsers.Email FROM
tblUsers INNER JOIN tblGroups " & _
"ON tblUsers.UserID=tblGroups.UserID " & _
"WHERE Group_Name = " & "'" & Me!Group & "'" & ";")
End If
While Not rst.EOF
Dim Session, dbs, MailDoc As Object
Dim RTItem As Variant
Dim EMailAddress, MailSubject, FileLocation, strLink
As String
strLink = Me!Notice_Hyperlink
EMailAddress = rst!Email
MailSubject = "Notice " & rst!Issue_Num
Set Session = CreateObject("Notes.NotesSession")
Set dbs = Session.getdatabase("my server", "my mail")
Set MailDoc = dbs.createdocument()
Set RTItem = MailDoc.createrichtextitem("Body")
MailDoc.Form = "Memo"
MailDoc.SendTo = EMailAddress
MailDoc.Subject = MailSubject
MailDoc.send (False)
rst.MoveNext
Wend
Exit_Command23_Click:
Exit Sub
Err_Command23_Click:
MsgBox Err.Description
Resume Exit_Command23_Click
End Sub
an Oject Required error message.
Private Sub Command23_Click()
On Error GoTo Err_Command23_Click
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
If Me!Group Is Null Then
Set rst = db.OpenRecordset("SELECT * FROM (tblResponse
INNER JOIN tblUsers " & _
"ON tblResponse.DeptID=tblUsers.DeptID) " & _
"WHERE tblResponse.Issue_Num = " & Me!Issue_Num)
Else
Set rst = db.OpenRecordset("SELECT tblUsers.Email FROM
tblUsers INNER JOIN tblGroups " & _
"ON tblUsers.UserID=tblGroups.UserID " & _
"WHERE Group_Name = " & "'" & Me!Group & "'" & ";")
End If
While Not rst.EOF
Dim Session, dbs, MailDoc As Object
Dim RTItem As Variant
Dim EMailAddress, MailSubject, FileLocation, strLink
As String
strLink = Me!Notice_Hyperlink
EMailAddress = rst!Email
MailSubject = "Notice " & rst!Issue_Num
Set Session = CreateObject("Notes.NotesSession")
Set dbs = Session.getdatabase("my server", "my mail")
Set MailDoc = dbs.createdocument()
Set RTItem = MailDoc.createrichtextitem("Body")
MailDoc.Form = "Memo"
MailDoc.SendTo = EMailAddress
MailDoc.Subject = MailSubject
MailDoc.send (False)
rst.MoveNext
Wend
Exit_Command23_Click:
Exit Sub
Err_Command23_Click:
MsgBox Err.Description
Resume Exit_Command23_Click
End Sub