Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > Access Forms Coding > Not finding ema...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 12 Topic 41539 of 43413
Post > Topic >>

Not finding email address to send to

by =?Utf-8?B?UmFpbg==?= <Rain@[EMAIL PROTECTED] > Aug 7, 2008 at 07:37 AM

I am fairly new at VBA for Access. I have created codes to send emails. One

code picks a specific person to send an email to - I am getting a runtime 
error that says "There must be at least one name or distribution list in
the 
To, Cc, or Bcc Box." Here is the code that looks for the email address:

Private Function HRRecip() As String

'Variable to define the recordset.
Dim myRS As DAO.Recordset
   
'Fill recordset with data from SQL.
     Set myRS = CurrentDb.OpenRecordset(strSQLResult)
'Test if the recordset contains records.
            If myRS.EOF And myRS.BOF Then
'No records found.
            MsgBox "Your selection gave no rows, please try again."
            GoTo exit_btnEmail_Click
            End If
        
myRS.MoveFirst
        
'Loop through all records til end of file.
     Do While Not myRS.EOF
                        
            If (myRS!Title) = "Admin Assistant" And (myRS!DateTerminated)
= 
"12/31/9999" Then
                HRRecip = (" & myRS!Email & ")
            End If

myRS.MoveNext
Loop

exit_btnEmail_Click:

'Close and clean up object variables, then done.
myRS.Close
Set myRS = Nothing

End Function

This is where I am having the problem:

With OlkHRMsg
'Make the "To" address of message.
    Dim OlkHRRecip As Outlook.Recipient
    Set OlkHRRecip = .Recipients.Add(HRRecip) <<<<<This line here says 
"nothing"
        OlkHRRecip.Type = olTo
       .Subject = "Attendance Re****t"
'Need to specify HTML for body format.
       .BodyFormat = olFormatHTML
'Must have Microsoft HTML Object Library checked in Tools/References.
       .HTMLBody = strBodyHR
       .send
End With

Please tell me what I am doing wrong. Thanks
 




 12 Posts in Topic:
Not finding email address to send to
=?Utf-8?B?UmFpbg==?= <  2008-08-07 07:37:22 
Re: Not finding email address to send to
"Damon Heron" &  2008-08-07 07:56:30 
Re: Not finding email address to send to
=?Utf-8?B?UmFpbg==?= <  2008-08-07 08:19:01 
Re: Not finding email address to send to
"Damon Heron" &  2008-08-07 08:29:39 
Re: Not finding email address to send to
=?Utf-8?B?UmFpbg==?= <  2008-08-07 09:10:01 
Re: Not finding email address to send to
=?Utf-8?B?UmFpbg==?= <  2008-08-07 08:41:01 
Re: Not finding email address to send to
"Damon Heron" &  2008-08-07 10:26:29 
Re: Not finding email address to send to
=?Utf-8?B?UmFpbg==?= <  2008-08-07 11:14:01 
Re: Not finding email address to send to
=?Utf-8?B?UmFpbg==?= <  2008-08-07 11:25:01 
Re: Not finding email address to send to
"Damon Heron" &  2008-08-07 12:41:53 
Re: Not finding email address to send to
=?Utf-8?B?UmFpbg==?= <  2008-08-07 13:03:01 
Re: Not finding email address to send to
=?Utf-8?B?UmFpbg==?= <  2008-08-08 10:04:01 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 21:22:04 CST 2008.