docmd sendobject not working in Vista

Hi Experts, i have developed an access database and coverted it to a runtime version in runtime 2007. The database includes some VBA code to automate the sending of a PDF attachment in an email and works fine on a number of PC's in our office which run XP. As soon as i tried to run this code on a friends machine that is running Vista it didn't work. It opens the report and then just stops......no error message. Any ideas why this is hapenning?
Dim stDocName As String
 
stDocName = "repInvoiceReport"
DoCmd.OpenReport stDocName, acPreview
 
DoCmd.SendObject acSendReport, "repInvoiceReport", acFormatPDF, To:=[CustEmail], Subject:="Invoice - " & " " & [CustLName] & " " & [CustSub], MessageText:=[EmailComment]

Open in new window

JocamaloneAsked:
Who is Participating?
 
puppydogbuddyConnect With a Mentor Commented:
In Access the new pdf format has to be downloaded as an add-in.  Was that done when Access was installed on the machine with the problem?
0
 
Jeffrey CoachmanMIS LiasonCommented:
Jocamalone,

1. You are declaring stDocName as "repInvoiceReport"
Yet you are not bothering to use this variable in the subsequent SendObject code?
;-)
(I have seen this be a showstopper in Access 2007)

2. Try explictly listing the Arguments.

3. "acViewPreview" is what is suggested by intellisense, so try using that instead of "acPreview".

Taken together, your code may end up looking something like the snippet below.

;-)

JeffCoachman


Dim stDocName As String
 
stDocName = "repInvoiceReport"
DoCmd.OpenReport stDocName, acViewPreview
 
DoCmd.SendObject acSendReport, stDocName, acformatPDF, Me.CustEmail, , , "Invoice - " & " " & [CustLName] & " " & [CustSub], [EmailComment]

Open in new window

0
 
Jeffrey CoachmanMIS LiasonCommented:
Also make sure to compile the code.
0
 
JocamaloneAuthor Commented:
Can't believe i forgot this, thanks puppydogbuddy.
Boag, appreciate your comments, some slack code on my part.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.