Hi All,
I spent a lot of time some years ago creating a database. I'm sure to most of you guys this is a very basic database, but as a nerwcomer to access it took me some time and with assistance from some lovely chaps on here and some other help i managed to create a working databes including some VB script.
We recently upgraded to MS 2016 and now two buttons that were on the forms don't work. the first of which, when pressed converted the form to a .pdf and opened up outlook with certain fields filled in ready to click send. This button now does nothing when pressed. - I was wondering if someone could check the code to see if there needs to be a small ampendment for it to work with office 2016?
VBA below
Private Sub Command164_Click()
Dim FileName As String
Dim FilePath As String
Dim oOutlook AsOutlook.Application
Dim oEmailItem As MailItem
FileName = "Plot "& Me.Customer_Plot_No & " " & Me.Development & "Work Sheet"
FilePath = "C:\Users\angie\Dropbox(Bell)\Bell Team Folder\BELL ELECTRICAL\CUSTOMER CARE\Remedial Reports\WorkSheets" & FileName & ".pdf"
'create temporary file
DoCmd.OutputTo acOutputReport,"Employee Worksheet", acFormatPDF, FilePath
If oOutlook Is Nothing Then
Set oOutlook= New Outlook.Application
End If
Set oEmailItem =oOutlook.CreateItem(olMailItem)
With oEmailItem
.To =Me.Combo148
.CC =""
.Subject ="Plot " & Me.Customer_Plot_No & " " &Me.Development & " Work Sheet"
.Attachments.Add FilePath
.Display
End With
Set oEmailItem = Nothing
Set oOutlook = Nothing
'delete temporary file
Kill FilePath
End Sub
The second button, when pressed simply saved the form as a pdf to a location on the end user PC. i have checked the location path and that is correct, however when this button is clicked nothing again happens - could you please check this?? - VBA below
Private Sub Command166_Click()
Dim FileName As String
Dim FilePath As String
FileName = "Plot "& Me.Customer_Plot_No & " " & Me.Development & "Work Sheet"
FilePath ="C:\Users\angie\Dropbox (Bell)\Bell Team Folder\BELL ELECTRICAL\CUSTOMERCARE\Remedial Reports\work sheets" & FileName & ".pdf"
DoCmd.OutputTo acOutputReport,"Employee Worksheet", acFormatPDF, FilePath
MsgBox "Report SavedSuccessfully", vbInformation, "save confirmed"
End Sub
Your help would be much appreciated!