Email Address fro Macro

G

Guest

I have a macro which opens up an Email. BUT I have to input the eMail address
before sending the email. Is there any way I can 'grabe' the email address
from the database itself?. All users in the DB have their email address
(Access 97)
Tnahs
 
S

Steve Schapel

MN,

I assume you are using a SendObject macro? If you are activating the
macro form an event on a form, and if that form contains the required
email address, then you can refer to the form control in the 'To'
argument of the SendObject action in your macro, using syntax such as
this...
=[Forms]![NameOfForm]![YourEmailControl]
 
G

Guest

Thank you.
I am using a SendObject and an event procedure on a form (THIS)

The email address is not in THIS form, but I can create a subform with the
emailaddresses and attach it to THIS from. Would I be able to use the
reference from the subform? is a subform considered as an open form?

Would the reference be something like:
=[Forms]![SUB FORM?]![YourEmailControl]
Steve Schapel said:
MN,

I assume you are using a SendObject macro? If you are activating the
macro form an event on a form, and if that form contains the required
email address, then you can refer to the form control in the 'To'
argument of the SendObject action in your macro, using syntax such as
this...
=[Forms]![NameOfForm]![YourEmailControl]

--
Steve Schapel, Microsoft Access MVP
I have a macro which opens up an Email. BUT I have to input the eMail address
before sending the email. Is there any way I can 'grabe' the email address
from the database itself?. All users in the DB have their email address
(Access 97)
Tnahs
 
G

Guest

Simple as that!!!
tahnk you , steve!

Steve Schapel said:
MN,

Like this...
=[Forms]![NameOfForm]![NameOfSubform]![YourEmailControl]

--
Steve Schapel, Microsoft Access MVP

Thank you.
I am using a SendObject and an event procedure on a form (THIS)

The email address is not in THIS form, but I can create a subform with the
emailaddresses and attach it to THIS from. Would I be able to use the
reference from the subform? is a subform considered as an open form?

Would the reference be something like:
=[Forms]![SUB FORM?]![YourEmailControl]
:
 
G

Guest

I know this is going to sound stupid but I just want to understand this and
any help would be appreciated!!!

I need to set up a Macro that will pull the email address from the table and
place it in the To: section of the email. Then I need to also pull some data
such and loan number and name to be placed in the Subject line. The Subject
Line will appear like this Congratulations, your (Name), loan number (Number)
is approved. I do not want the email to be sent as the body needs to be
available to add any additional information before sending it.

I have a Table with all the Email Addresses and a different table for the
file information. The Query will pull the email address, borrowers Name and
Loan number.

Steve Schapel said:
MN,

Like this...
=[Forms]![NameOfForm]![NameOfSubform]![YourEmailControl]

--
Steve Schapel, Microsoft Access MVP

Thank you.
I am using a SendObject and an event procedure on a form (THIS)

The email address is not in THIS form, but I can create a subform with the
emailaddresses and attach it to THIS from. Would I be able to use the
reference from the subform? is a subform considered as an open form?

Would the reference be something like:
=[Forms]![SUB FORM?]![YourEmailControl]
:
 
S

Steve Schapel

Myztiques,

Your question is different from the example in the earlier post that you
quoted. In that example, we were looking to reference the value for the
email from the current record on a form. In your example, you could do
the same, if you had your query as the Record Source of the form, and
the form is open at the time that the email is sent. Then you can do
the same idea that I suggested before, i.e. in the To argument of the
SendObject action in yyour macro, you can put like this:
=[Forms]![NameOfYourForm]![EmailAddress]
.... and in the Subject argument, something like this:
="Congratulations, " & [Forms]![NameOfYourForm]![Borrower] & ", loan
number " & [Forms]![NameOfYourForm]![Loan Number] & " is approved"

Alternatively, you could reference the values from the query itself
using DLookup functions, so...

To: =DLookup("[EmailAddress]","YourQuery")
Subject: ="Congratulations, " & DLookup("[Borrower]","YourQuery") & ",
loan number " & DLookup("[Loan Number]","YourQuery") & " is approved"

To have the email open for editing before sending, set the Edit Message
argument in your macro to Yes.

--
Steve Schapel, Microsoft Access MVP
I know this is going to sound stupid but I just want to understand this and
any help would be appreciated!!!

I need to set up a Macro that will pull the email address from the table and
place it in the To: section of the email. Then I need to also pull some data
such and loan number and name to be placed in the Subject line. The Subject
Line will appear like this Congratulations, your (Name), loan number (Number)
is approved. I do not want the email to be sent as the body needs to be
available to add any additional information before sending it.

I have a Table with all the Email Addresses and a different table for the
file information. The Query will pull the email address, borrowers Name and
Loan number.

Steve Schapel said:
MN,

Like this...
=[Forms]![NameOfForm]![NameOfSubform]![YourEmailControl]

--
Steve Schapel, Microsoft Access MVP

Thank you.
I am using a SendObject and an event procedure on a form (THIS)

The email address is not in THIS form, but I can create a subform with the
emailaddresses and attach it to THIS from. Would I be able to use the
reference from the subform? is a subform considered as an open form?

Would the reference be something like:
=[Forms]![SUB FORM?]![YourEmailControl]
:
 

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