Having trouble with sendobject - transferring data from a form

C

carriolan

Hi
I am using MS Access 2003 and I am trying to automate this send object
statement. Although I have sucessfully hard coded the the email
address, subject and message in the statement, I am unable to pass the
data from a form. If say the form fielld were txtEmail, txtSubject and
txtMessage How would they be inserted into this statement please:

DoCmd.SendObject acSendReport, "rptFullReading", "Snapshot Format
(*.snp)", "(e-mail address removed)", , , "Sending A Report: Full Reading",
"This is your report", True

Thanks
 
R

Rick Brandt

Hi
I am using MS Access 2003 and I am trying to automate this send object
statement. Although I have sucessfully hard coded the the email
address, subject and message in the statement, I am unable to pass the
data from a form. If say the form fielld were txtEmail, txtSubject and
txtMessage How would they be inserted into this statement please:

DoCmd.SendObject acSendReport, "rptFullReading", "Snapshot Format
(*.snp)", "(e-mail address removed)", , , "Sending A Report: Full Reading",
"This is your report", True

Assuming that the statement above is running from the code module of the form in
question...

DoCmd.SendObject acSendReport, "rptFullReading", "Snapshot Format (*.snp)",
Me.txtEmail, , , Me.txtSubject, Me.txtMessage, True
 
C

carriolan

Hi Rick
I'll have a go thanks. BTW is there any difference between Me!txtMsg
and Me.txtMsg?
Regards
 
R

Rick Brandt

Hi Rick
I'll have a go thanks. BTW is there any difference between Me!txtMsg
and Me.txtMsg?
Regards

Me!txtMsg
Returns the *member* txtMsg of the default collection of Me. When "Me" is a
form or report the default collection is the Controls collection so you get
a reference to the control named txtMsg.

Me.txtMsg
Returns the *property or method* txtMsg of the object Me.

Since Access exposes controls on forms and reports as properties of the
form/report both syntaxes work.

Many consider the bang (!) notation "more correct" when referring to a
control, but many prefer the dot because it exposes intellisense more readly
and if you spell the name of the control wrong the dot notation will raise
an error at compile time while the bang notation wouldn't raise an error
until runtime.

There are types of corruption that can cause the dot notation to suddenly
stop working, but in most cases I consider that a good thing. It makes the
corruption immediately noticeable so I can fix it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top