email button

T

Tony F

A few days ago I asked the question below, I got an answer which got me part
of the way but not completely, now I can't find the string to add to it so
have had to resubmit the question.

I am setting up a database of change requests and would like to notify the
approvers, via a command button, whan a new request has been raised.
After the necessary boxes on the "Request Form" have been completed I want
the applicant to "click" a button to send an e-mail to the approvers. Can
anyone tell me how to do this?
The following conditions apply.
I am using Access 2000 & Outlook.
The requests will be serialised, auto number, I need to send only the
current request.
The approvers will be constant.
The body of the e-mail will be a simple message e.g. "please review Change
Request 1234"

I now realise the question wasn't clear. I want to be able to automatically
enter the form Ser No in the body of the e-mail, the 1234 in "Please review
Change Request 1234" above. And I would like the mail to be sent by the same
"click".
Can this be done?

Many thanks

Tony F
 
A

Arvin Meyer MVP

I'm using the code to automate Outlook that I wrote about 10 years ago:

http://www.datastrat.com/Code/OutlookEmail.txt

I'll adapt it for your usage. You need to set a reference to your version of
Outlook in the Tools menu of your code window, and change the name of the
Command button and the email address, which can also come from the form.
Notice how I made the subject and the body the same. You can change that.
Uncomment the ReadReceipt if you want one.:

Private Sub Command0_Click()
'Arvin Meyer 03/12/1999
'Updated 5/29/2009
On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.To = "(e-mail address removed)"
.Subject = "Please review Change Request " & Me.[Ser No] & " above."
.body = "Please review Change Request " & Me.[Ser No] & " above."
.Send
'.ReadReceiptRequested
End With

Exit_Here:
Set objOutlook = Nothing
Exit Sub

Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here

End Sub
 
T

Tony F

Thanks Arvin
Almost there, I used the code below with what I believe are the correct
amendments, I'm now getting the error message "2465: Microsoft Access can't
find the field '|' referred to in your expression. Can you tell me where I
might be going wrong.

Thanks

Tony F

Arvin Meyer MVP said:
I'm using the code to automate Outlook that I wrote about 10 years ago:

http://www.datastrat.com/Code/OutlookEmail.txt

I'll adapt it for your usage. You need to set a reference to your version of
Outlook in the Tools menu of your code window, and change the name of the
Command button and the email address, which can also come from the form.
Notice how I made the subject and the body the same. You can change that.
Uncomment the ReadReceipt if you want one.:

Private Sub Command0_Click()
'Arvin Meyer 03/12/1999
'Updated 5/29/2009
On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.To = "(e-mail address removed)"
.Subject = "Please review Change Request " & Me.[Ser No] & " above."
.body = "Please review Change Request " & Me.[Ser No] & " above."
.Send
'.ReadReceiptRequested
End With

Exit_Here:
Set objOutlook = Nothing
Exit Sub

Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here

End Sub

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Tony F said:
A few days ago I asked the question below, I got an answer which got me
part
of the way but not completely, now I can't find the string to add to it so
have had to resubmit the question.

I am setting up a database of change requests and would like to notify the
approvers, via a command button, whan a new request has been raised.
After the necessary boxes on the "Request Form" have been completed I want
the applicant to "click" a button to send an e-mail to the approvers. Can
anyone tell me how to do this?
The following conditions apply.
I am using Access 2000 & Outlook.
The requests will be serialised, auto number, I need to send only the
current request.
The approvers will be constant.
The body of the e-mail will be a simple message e.g. "please review Change
Request 1234"

I now realise the question wasn't clear. I want to be able to
automatically
enter the form Ser No in the body of the e-mail, the 1234 in "Please
review
Change Request 1234" above. And I would like the mail to be sent by the
same
"click".
Can this be done?

Many thanks

Tony F
 
T

Tony F

Thanks Arvin, I've found my error. Email button now doing exactly what I want.

Tony F

Tony F said:
Thanks Arvin
Almost there, I used the code below with what I believe are the correct
amendments, I'm now getting the error message "2465: Microsoft Access can't
find the field '|' referred to in your expression. Can you tell me where I
might be going wrong.

Thanks

Tony F

Arvin Meyer MVP said:
I'm using the code to automate Outlook that I wrote about 10 years ago:

http://www.datastrat.com/Code/OutlookEmail.txt

I'll adapt it for your usage. You need to set a reference to your version of
Outlook in the Tools menu of your code window, and change the name of the
Command button and the email address, which can also come from the form.
Notice how I made the subject and the body the same. You can change that.
Uncomment the ReadReceipt if you want one.:

Private Sub Command0_Click()
'Arvin Meyer 03/12/1999
'Updated 5/29/2009
On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.To = "(e-mail address removed)"
.Subject = "Please review Change Request " & Me.[Ser No] & " above."
.body = "Please review Change Request " & Me.[Ser No] & " above."
.Send
'.ReadReceiptRequested
End With

Exit_Here:
Set objOutlook = Nothing
Exit Sub

Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here

End Sub

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Tony F said:
A few days ago I asked the question below, I got an answer which got me
part
of the way but not completely, now I can't find the string to add to it so
have had to resubmit the question.

I am setting up a database of change requests and would like to notify the
approvers, via a command button, whan a new request has been raised.
After the necessary boxes on the "Request Form" have been completed I want
the applicant to "click" a button to send an e-mail to the approvers. Can
anyone tell me how to do this?
The following conditions apply.
I am using Access 2000 & Outlook.
The requests will be serialised, auto number, I need to send only the
current request.
The approvers will be constant.
The body of the e-mail will be a simple message e.g. "please review Change
Request 1234"

I now realise the question wasn't clear. I want to be able to
automatically
enter the form Ser No in the body of the e-mail, the 1234 in "Please
review
Change Request 1234" above. And I would like the mail to be sent by the
same
"click".
Can this be done?

Many thanks

Tony F
 
T

Tony F

I have now further developed my database and added a new button to the form.
I have used the code below for the new button, where "Allocated Engineer" is
a Table Column and bound Form Cell.

Private Sub Command38_Click()
'On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
..To = "Me.[Allocated Engineer]"
..Subject = "Work Instruction Change Request "
..Body = "Please implement Change Request " & Me.[Serial No]
..Send
'.ReadReceiptRequested
End With

Exit_Here:
Set objOutlook = Nothing
Exit Sub

Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here

End Sub

Now getting the error "Outlook doesn't recognize one or more names" is it
not possible to use column names or have I just identified it incorrectly.

Thanks

Tony F

Tony F said:
Thanks Arvin, I've found my error. Email button now doing exactly what I want.

Tony F

Tony F said:
Thanks Arvin
Almost there, I used the code below with what I believe are the correct
amendments, I'm now getting the error message "2465: Microsoft Access can't
find the field '|' referred to in your expression. Can you tell me where I
might be going wrong.

Thanks

Tony F

Arvin Meyer MVP said:
I'm using the code to automate Outlook that I wrote about 10 years ago:

http://www.datastrat.com/Code/OutlookEmail.txt

I'll adapt it for your usage. You need to set a reference to your version of
Outlook in the Tools menu of your code window, and change the name of the
Command button and the email address, which can also come from the form.
Notice how I made the subject and the body the same. You can change that.
Uncomment the ReadReceipt if you want one.:

Private Sub Command0_Click()
'Arvin Meyer 03/12/1999
'Updated 5/29/2009
On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.To = "(e-mail address removed)"
.Subject = "Please review Change Request " & Me.[Ser No] & " above."
.body = "Please review Change Request " & Me.[Ser No] & " above."
.Send
'.ReadReceiptRequested
End With

Exit_Here:
Set objOutlook = Nothing
Exit Sub

Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here

End Sub

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


A few days ago I asked the question below, I got an answer which got me
part
of the way but not completely, now I can't find the string to add to it so
have had to resubmit the question.

I am setting up a database of change requests and would like to notify the
approvers, via a command button, whan a new request has been raised.
After the necessary boxes on the "Request Form" have been completed I want
the applicant to "click" a button to send an e-mail to the approvers. Can
anyone tell me how to do this?
The following conditions apply.
I am using Access 2000 & Outlook.
The requests will be serialised, auto number, I need to send only the
current request.
The approvers will be constant.
The body of the e-mail will be a simple message e.g. "please review Change
Request 1234"

I now realise the question wasn't clear. I want to be able to
automatically
enter the form Ser No in the body of the e-mail, the 1234 in "Please
review
Change Request 1234" above. And I would like the mail to be sent by the
same
"click".
Can this be done?

Many thanks

Tony F
 

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