• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 523
  • Last Modified:

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

0
Jocamalone
Asked:
Jocamalone
  • 2
  • 2
1 Solution
 
puppydogbuddyCommented:
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 CoachmanCommented:
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 CoachmanCommented:
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now