connieharper
Registered User.
- Local time
- Today, 02:14
- Joined
- Sep 15, 2000
- Messages
- 17
I am stumped! I use the following Access97 Code to send a report to several users via email. This routine works fine on one computer but on another I get the following Microsoft Access error message: Run-Time error 2296 "The password is invalid; the message wasn't sent.
I am running Windows 98 and Outlook Express 5 on both computers. Outlook Express works fine and retrieves messages fine for this user. It has the right password. What password is the error referring to? Anyone Know?
When I debug, the program stops at the SENDOBJECT Command Line in the code. Does the full version of Outlook have to be installed on the computer?
Thanks in advance.
Private Sub Command18_Click()
'set up the vars
Dim db As Database
Dim RstTmp As Recordset
Dim Loop1 As Long
Dim SqlStr As String
Set db = CurrentDb()
'Set up the query (paste this string into the SQL view of a query to see how it works)
SqlStr = "SELECT People_Events_TOK.PersonID, people.[First Name], people.[E Mail] FROM People_Events_TOK INNER JOIN people ON People_Events_TOK.PersonID = people.PersonID GROUP BY People_Events_TOK.PersonID, people.[First Name], people.[E Mail];"
'get it into a recordset
Set RstTmp = db.OpenRecordset(SqlStr, dbOpenSnapshot)
DoEvents
'count the records (=people)
'get an accurate recordcount(
On Error Resume Next
RstTmp.MoveLast
RstTmp.MoveFirst
On Error GoTo 0
')
'if nothing to do
If RstTmp.RecordCount = 0 Then
MsgBox "there is nobody in the events list"
Exit Sub
End If
For Loop1 = 1 To RstTmp.RecordCount
'put the person ID into the hidden text box, for the report to find
Me.TheTextBox.Value = RstTmp.Fields!personID.Value
'send the report
DoCmd.RunMacro "instructor_macro"
DoCmd.SendObject acSendReport, Instructor_update1", acFormatHTML, RstTmp.Fields![E Mail].Value, , , "Your Event Schedule", , False
'move to the next person
RstTmp.MoveNext
Next Loop1
'tell the user all is OK
MsgBox (Loop1 - 1) & " Messages sent"
db.Close
End Sub
I am running Windows 98 and Outlook Express 5 on both computers. Outlook Express works fine and retrieves messages fine for this user. It has the right password. What password is the error referring to? Anyone Know?
When I debug, the program stops at the SENDOBJECT Command Line in the code. Does the full version of Outlook have to be installed on the computer?
Thanks in advance.
Private Sub Command18_Click()
'set up the vars
Dim db As Database
Dim RstTmp As Recordset
Dim Loop1 As Long
Dim SqlStr As String
Set db = CurrentDb()
'Set up the query (paste this string into the SQL view of a query to see how it works)
SqlStr = "SELECT People_Events_TOK.PersonID, people.[First Name], people.[E Mail] FROM People_Events_TOK INNER JOIN people ON People_Events_TOK.PersonID = people.PersonID GROUP BY People_Events_TOK.PersonID, people.[First Name], people.[E Mail];"
'get it into a recordset
Set RstTmp = db.OpenRecordset(SqlStr, dbOpenSnapshot)
DoEvents
'count the records (=people)
'get an accurate recordcount(
On Error Resume Next
RstTmp.MoveLast
RstTmp.MoveFirst
On Error GoTo 0
')
'if nothing to do
If RstTmp.RecordCount = 0 Then
MsgBox "there is nobody in the events list"
Exit Sub
End If
For Loop1 = 1 To RstTmp.RecordCount
'put the person ID into the hidden text box, for the report to find
Me.TheTextBox.Value = RstTmp.Fields!personID.Value
'send the report
DoCmd.RunMacro "instructor_macro"
DoCmd.SendObject acSendReport, Instructor_update1", acFormatHTML, RstTmp.Fields![E Mail].Value, , , "Your Event Schedule", , False
'move to the next person
RstTmp.MoveNext
Next Loop1
'tell the user all is OK
MsgBox (Loop1 - 1) & " Messages sent"
db.Close
End Sub