Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SendObject command

Status
Not open for further replies.

jjdavis

Technical User
Aug 27, 2002
17
0
0
US
I am trying to do a SendObject command and in the To argument, I am trying to put a list of names. However, it is giving me a "Compile error: Expected: End of statement" error. I tried the semi-colon, a comma, semicolon with single quotes around the list, but I'm still not sure what I'm doing wrong. I am using Access 2000 with XP, could that be an issue?
 
Hey there JJ,

Have you tried putting each email address is quotations, and separate each with a semi-colon? Alternatively, you could create an unbound text field on the form from which you send the email and add all of the addresses there (separated with a semi-colon). Then in your sendobject command, do something like this:
Code:
Private cmdSend()

Dim stTo As String

stTo = Me.txtToField.Value [COLOR=green]'use your field name'[/color]
DoCmd.SendObject acSendNoObject, , , stTo,, , Subject, Body

End Sub

You wouldn't happen to be from Hammond, LA?
 
Better yet, try this. You can just set your email addresses at stTo=.

Code:
Private cmdSend()

Dim stTo As String

stTo = "someone@somewhere.com; somebody@someplace.net;"
DoCmd.SendObject acSendNoObject, , , stTo,, , Subject, Body

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top