Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

E-Mail the Current Record Using SendObject Command

Status
Not open for further replies.

Tamrak

MIS
Jan 18, 2001
213
US
Hello,

I have some problems that might need just a touch of codes.

I built a survey form that allowed the user to key in the information. Every times they finish inputting, (by clicking the Save button), the e-mail will send the information on the current record. I use Microsoft Outlook.


When I use the following code, it works on the first entry. I set the property of the form-> Data Entry = Yes. So, I can go directly to the new record.

Let say, I have 6 fields and the form name is "Survey":

Cal_start -- (date) -- (Date of Survey)
Time_start -- (date/time)
Time_end -- (date/time)
Ticket -- (text) -- (Survey Ticket Number)
QA -- (text) -- (checked by:)
Name -- (text) (person who did the survey)
----------------------------------------------
The codes that I use at the click button (save) are:

Private Sub Save_Record_Click()
On Error GoTo Err_Save_Record_Click

Dim MCal_start As Date
Dim MTime As String
Dim MTicket As String
Dim QAName As String

Alltime = "Call Start :" & Me![Cal_start]
MTime = "Time Start: " & Me![Time_start] & "- - -Time End: " & Me![Time_end]
MTicket = "Ticket Number: " & Me![Ticket]
QAName = "Surveyed by: " & Me![Name] & "- - -Checked By: " & Me![QA]

BodyText = Alltime & Chr$(10) & Chr$(13)
BodyText = BodyText & MTime & Chr$(10) & Chr$(13)
BodyText = BodyText & MTicket & Chr$(10) & Chr$(13)
BodyText = BodyText & QAName

DoCmd.SendObject acSendNoObject, "", acFormatTXT, "myname@mycompany.com; myfriendname@mycompany.com", "", "", "Survey has been input!",BodyText, False,

Exit_Save_Record_Click:
Exit Sub

Err_Save_Record_Click:
MsgBox Err.Description
Resume Exit_Save_Record_Click

End Sub
-----------------------------------------------------

The form will allow the user to click the right arrow button and input a new record. Sometimes, we have five surveys in a row. Our intention is to have the program sent us five separate e-mails.


Problems that I have:

1. I received an initial e-mail on the first entry. When the user finishes the second entry, the hourglass showed up and hung the system. I finally got an e-mail. When the user finishes the third entry, the error popped up: "The SendObject action was cancelled."

2. Sometimes, I got an e-mail and my friend did not receive the e-mail. The code specifically uses two e-mail addresses and separated by semi-colon. The e-mail addresses are correct.

I wonder why sometimes this code works and sometimes it does not. I think I forgot something or to refresh it when I start a new entry.

My brain is fried and I could not think of anything right now. It might be just a small problem.

Can anyone enlighten me? Thanks.
 
Hello all,

I posted this e-mail a few days ago and did not hear any possible solution. Does anyone has the comment regarding the problem that I have?

All comments are welcome. Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top