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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

e-mail error from Access2000 to Outlook2003 sp3

Status
Not open for further replies.

Pampas58

Technical User
May 27, 2004
24
US
I get the following error when the code below tries to fire off Outlook2003 to send an e-mail to the approver. The worse part of it is, that it only happens on some machines. I've talked to the IT folks and they have not seen anything that gives them a clue as to why some machines are different than others.

Cannot start Microsoft Outlook. A program error ocurred. Quit Outlook and Mircorsoft Windows and then start again.

Any ideas as to what I might be able to try, or guide my IT folks with?

The specific line of code
DoCmd.SendObject , , , vEmailTo, vEmailCC, , sSubject, strBody


The full code that works on most, but not all machines


'=== This program sends an e-mail with all the relevant information to the approver

On Error GoTo Err_cmdSendEmailForApproval_Click

'=== This section Sets the variable types
Dim strSender, strStartDate As Variant
Dim vRequesterEmail, vHrsToDate As Variant
Dim sStatus As String

'=== The following command saves the record before the rest of the
'=== actions take place
sStatus = "01 - Pending"
[Status] = sStatus
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

'=== This section gets the information from the form
'=== that is needed to send the email.

strSender = [Employee]
strApp_ID = [Approver]
strStartDate = [Abscense Date Start]
strEndDate = [Abscense Date End]
vHoursOff = [Abscense Hours]

'=== The following section executes look ups on various tables
'=== and a query to get the information needed to populate the e-mail

vRequesterLastName = DLookup("[Last Name]", "tbl_employees", "[Emp_ID]=" & strSender)

vRequesterFirstName = DLookup("[First Name]", "tbl_employees", "[Emp_ID]=" & strSender)

vHrsPerYear = DLookup("[Annual Vacation in hours]", "tbl_employees", "[Emp_ID]=" & strSender)

vHrsToDate = DLookup("[Hours To Date]", "qryTotalHrsToDateByEmployee", "[Emp_ID]=" & strSender)

vEmailTo = DLookup("", "tbl_employees", "[Emp_ID]=" & strApp_ID)

vEmailCC = DLookup("[email]", "tbl_employees", "[Emp_ID]=" & strSender)

'=== The Following calculates the hours yet to be approved (Available)

vHrsLeftToApprove = vHrsPerYear - vHrsToDate

'=== The following sets the "Subject" line of the email

sSubject = "Vacation Request Submitted by: "
sSubject = sSubject & vRequesterFirstName
sSubject = sSubject & " " & vRequesterLastName


'=== The following creates the body of the e-mail as a form letter.

strBody = "Vacation Request " & vbCrLf & vbCrLf & vbCrLf
strBody = strBody & "Vacation Starts on..........: "
strBody = strBody & strStartDate & vbCrLf
strBody = strBody & "Vacation Ends On............: "
strBody = strBody & strEndDate & vbCrLf & vbCrLf
strBody = strBody & "Amount of Time Requested off: "
strBody = strBody & vHoursOff & Chr$(32)
strBody = strBody & "Hrs"
strBody = strBody & vbCrLf & vbCrLf
strBody = strBody & "Vacation Hours Approved to Date: "
strBody = strBody & vHrsToDate
strBody = strBody & vbCrLf & vbCrLf
strBody = strBody & "Vacation Hours Available per Year: "
strBody = strBody & vHrsPerYear
strBody = strBody & vbCrLf & vbCrLf

strBody = strBody & "Vacation Hours Remaining Prior to This Request: "
strBody = strBody & vHrsLeftToApprove
strBody = strBody & vbCrLf & vbCrLf

strBody = strBody & "Please go to the Vacation Request System and to Approve or Deny the Vacation Request"
strBody = strBody & vbCrLf & vbCrLf
strBody = strBody & "Thank You"
strBody = strBody & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf
strBody = strBody & "THIS E-MAIL WAS AUTOMATICALLY GENERATED FROM THE VACATION REQUEST SYSTEM"

'=== The next statment sends the e-mail using the variables above
'=== this method was used so that any e-mail the user hase
'=== can send the e-mail.
[b]DoCmd.SendObject , , , vEmailTo, vEmailCC, , sSubject, strBody[/b]

[StatusText] = "E-MAIL SENT - Do Not Edit"[/i]

 
Try this and see if the email is veiwable

DoCmd.SendObject , , , vEmailTo, vEmailCC, , sSubject, strBody, 1

This way you can see the info of the email

This will tell you if its a code issue or an email sending issue

ck1999
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top