I am not sure why I am getting this error in red when I run the code. It is for a report to be saved in a folder. I am using Access 2016 (365). Here is the code below and thanks for your help!!!
Code:
Private Sub btnFolder_Click()
Dim strFolder As String
Dim strCaption As String
[COLOR="Red"][U]Dim fd As FileDialog
[/U][/COLOR]
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
If fd.Show Then
strFolder = fd.SelectedItems.Item(1)
DoCmd.OpenReport "rptCarlsbad", acViewDesign, , , acHidden
strCaption = Reports!rptCarlsbad.Caption
DoCmd.Close acReport, "rptCarlsbad", acSaveNo
DoCmd.OutputTo acOutputReport, "rptCarlsbad", acFormatPDF, strFolder & "\" & strCaption & ".pdf"
End If
Set fd = Nothing
End Sub
[Code]