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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate To Argument in SendObject Field

Status
Not open for further replies.

kilt

Technical User
Nov 12, 2002
52
GB
Hi everyone,
I have a form that fills in details to produce a Monthly Statement. On the same form, I've created a command button which through a macro creates the statement (OpenReport Action) then generates the Report as an attatchment ready to be sent to the recipient. How can I automate the insertion of the Recipients E-Mail address into the To field? Just now I have to copy the address from a field within the form & paste it into the E-Mail (a bit of a pain sometimes as you have to wait on the generating of the statement instead of it being sent automatically through the Edit Message - No Argument)

Thanks In Advance
Any Pointers Greatly Appreciated!

Kilt
 
Hey Kilt.

1 create a variable to hold the "to" email address

Dim ToVar As String

2 set the value of the ToVar variable to the value of the "to" on your form

i.e.

ToVar = Me!NameofToField.value

3 then place the ToVar variable in the To section of your SendObject statement

Like below:

DoCmd.SendObject acObjectType, "ObjectName", "Format", ToVar, "", "", "Enter Subject Here", "Enter Message Text Here", False, ""


if this does not work, please post back.

hope this helps you.
 
cghoga - It worked a treat & I am not a programmer! (very limited)I've tested it out & everything is ok apart from the outlook security prompt before sending each report. i've looked this up & there is a way around this by using Outlook Redemption. I was wondering if you knew if this caused any security issues?

Cheers & All the Best,

Kilt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top