SendObject Macro

C

craigh

I am using the SendObject function send a report to
specific people. The e-mail addresses are stored in a a
field in the same table the report is based on.The table
is called Reversals Details.

I have the report detailed in then Object Name and in the
To field i have
":=[Reversals Details]![Team Leader]!"

I get the Outlook message box asking me to approve the
message. After clicking 'Yes' i get a message saying
'Unknown message recipient(s); the message was not sent.@

Any help would be greatly accepted.

Thanks!
 
J

JS

I don't believe you can put functions in macro fields.
I've tried renaming tables based on the Now() function
(to backup tables based on date), but it never worked.

When I use the "Output to" command, I always find it best
to create a distribution list inside Outlook, and use
that distribution list in the "To" field.
 
S

Steve Schapel

Craigh,

There is a : in the beginning of your expression, which is not correct.
And there is a ! at the end of your expression, which is not correct.
And [Reversals Details]![Team Leader] is meaning less to Access
anyway... this is incorrect syntax to refer to a field in a table, and
even if you could refer to a field in a table in this way, you couldn't
use it in an expression because how is Access supposed to know which
record to look in?

You can do the kind of thing you want if the email address is in the
current record on a form. If the control on the form is called Team
Leader, and if it's the form that you are callig the macro from, it
should work to just put...
=[Team Leader]
.... if the form is another form (has to be open at the time, of course),
you need the equivalent of...
=[Forms]![NameOfYourForm]![Team Leader]
 
S

Steve Schapel

JS,

First of all, Craigh wasn't trying to use a function.

In any case, this is perfectly standard procedure. As regards your
table renaming example, here is an example of the syntax to put in the
New Name argument of the Rename macro action...
="fred" & Format(Date(),"mmdd")
 
G

Guest

Thanks Steve, that works perfectly now.

-----Original Message-----
Craigh,

There is a : in the beginning of your expression, which is not correct.
And there is a ! at the end of your expression, which is not correct.
And [Reversals Details]![Team Leader] is meaning less to Access
anyway... this is incorrect syntax to refer to a field in a table, and
even if you could refer to a field in a table in this way, you couldn't
use it in an expression because how is Access supposed to know which
record to look in?

You can do the kind of thing you want if the email address is in the
current record on a form. If the control on the form is called Team
Leader, and if it's the form that you are callig the macro from, it
should work to just put...
=[Team Leader]
.... if the form is another form (has to be open at the time, of course),
you need the equivalent of...
=[Forms]![NameOfYourForm]![Team Leader]

--
Steve Schapel, Microsoft Access MVP

I am using the SendObject function send a report to
specific people. The e-mail addresses are stored in a a
field in the same table the report is based on.The table
is called Reversals Details.

I have the report detailed in then Object Name and in the
To field i have
":=[Reversals Details]![Team Leader]!"

I get the Outlook message box asking me to approve the
message. After clicking 'Yes' i get a message saying
'Unknown message recipient(s); the message was not sent.@

Any help would be greatly accepted.

Thanks!
.
 

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