Hello. I have suddenly been getting a run-time error on a report I have been running for the past two years without issue. The code would create the report, save it to the specified file path and name the report based on a data entered in a particular field. This was working fine up until December and now it hasn't worked properly for the year.
The text in red is what is highlighted in the error. I have tried compacting and repairing the db, updating my Adobe license and even uninstalling and reinstalling both programmes. The file path hasn't changed and I haven't had to do any maintenance to the db in almost a year...everything was working just fine.
Any suggestions what else to look for?
Code:
Private Sub CmdPrintTender_Click()
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[PW_No] = """ & Me.[PW_No] & """"
DoCmd.OpenReport "RPTProspectiveWorks", acViewPreview, , strWhere
End If
Dim FileName As String
Dim FilePath As String
FileName = Me.TenderNo & " - " & Me.ProjectName
FilePath = "J:\Tender Detail Forms\" & FileName & ".pdf"
[COLOR="Red"] DoCmd.OutputTo acOutputReport, "RPTProspectiveWorks", acFormatPDF, FilePath
[/COLOR] MsgBox "Tender Detail Form has been successfully created and saved to J:\Tender Detail Forms", vbInformation, "Enter Tender Details"
End Sub
The text in red is what is highlighted in the error. I have tried compacting and repairing the db, updating my Adobe license and even uninstalling and reinstalling both programmes. The file path hasn't changed and I haven't had to do any maintenance to the db in almost a year...everything was working just fine.
Any suggestions what else to look for?