send email to that employee on the current record in a form

G

Guest

I am trying to send a report by email, using the macro sendobject method. I
used a command button to send the email from a form. The query which is used
for the report creation has the email id of different employees. I used
the [forms]![formname]![fieldname] to send the current record as a report
format by email. ((My form does not have an email field but the report has
the email field. ))

My question is would I be able to use [query]![queryname]![fieldname] in the
macros sendobject methods 'TO' field such that when you are in the form and
the employee name is say for example Scott if I click send email the email
has to be send to Scott.

How do I accomplish this
Thanks in advance
S.Matthew
 
S

Steve Schapel

S.Matthew,

[query]![queryname]![fieldname] is not valid syntax. Put the email
field into the query that the form is based on, and represent it on the
form. You can use an invisible control. Then you can refer to this in
the SendObject argument as:
=[forms]![formname]![fieldname]
 
G

Guest

I'm having the same problem but I'm using this syntax,
[report]![reportname]![fieldname]! in the "TO" part of the SendObject Action
and I'm coming up with an error "unknown message recipient(s).

Steve Schapel said:
S.Matthew,

[query]![queryname]![fieldname] is not valid syntax. Put the email
field into the query that the form is based on, and represent it on the
form. You can use an invisible control. Then you can refer to this in
the SendObject argument as:
=[forms]![formname]![fieldname]

--
Steve Schapel, Microsoft Access MVP


S.Matthew said:
I am trying to send a report by email, using the macro sendobject method. I
used a command button to send the email from a form. The query which is used
for the report creation has the email id of different employees. I used
the [forms]![formname]![fieldname] to send the current record as a report
format by email. ((My form does not have an email field but the report has
the email field. ))

My question is would I be able to use [query]![queryname]![fieldname] in the
macros sendobject methods 'TO' field such that when you are in the form and
the employee name is say for example Scott if I click send email the email
has to be send to Scott.

How do I accomplish this
Thanks in advance
S.Matthew
 
S

Steve Schapel

Holly,

There are a number of problems with your approach
1. You forgot to put a = in the front of the expression
2. You have a ! at the end that shouldn't be there
3. In another context to refer to the Reports collection, you need an s
on the end of the word Reports, but...
4. In this context, it doesn't make sense to refer to a report, it needs
to be a form control.

--
Steve Schapel, Microsoft Access MVP

I'm having the same problem but I'm using this syntax,
[report]![reportname]![fieldname]! in the "TO" part of the SendObject Action
and I'm coming up with an error "unknown message recipient(s).

:

S.Matthew,

[query]![queryname]![fieldname] is not valid syntax. Put the email
field into the query that the form is based on, and represent it on the
form. You can use an invisible control. Then you can refer to this in
the SendObject argument as:
=[forms]![formname]![fieldname]

--
Steve Schapel, Microsoft Access MVP


S.Matthew said:
I am trying to send a report by email, using the macro sendobject method. I
used a command button to send the email from a form. The query which is used
for the report creation has the email id of different employees. I used
the [forms]![formname]![fieldname] to send the current record as a report
format by email. ((My form does not have an email field but the report has
the email field. ))

My question is would I be able to use [query]![queryname]![fieldname] in the
macros sendobject methods 'TO' field such that when you are in the form and
the employee name is say for example Scott if I click send email the email
has to be send to Scott.

How do I accomplish this
Thanks in advance
S.Matthew
 

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