Hi,
It feels strange to be the one doing the asking after so much answering, but this one is driving me crazy.
I have a simple database with a table, a form, and a report based on the table. It's something I made quickly to test out an idea, and so the table only has four or five records of useless data in it.
The idea is for the user to click a command button on the form, which will cause a system folder picker to display. Upon selecting a location and hitting OK, the report in the database gets exported to that location as a PDF named according to the report's caption. The code in the On Click event for the button is as follows:
This works fine, but when I subsequently try to close the database, Access freezes and I have to shut it down using Task Manager. Now, if I open the folder picker and hit "Cancel" (no exporting going on), I have no problem. It's only if Access actually exports the report that I run into trouble.
Any ideas?
Pat
It feels strange to be the one doing the asking after so much answering, but this one is driving me crazy.
I have a simple database with a table, a form, and a report based on the table. It's something I made quickly to test out an idea, and so the table only has four or five records of useless data in it.
The idea is for the user to click a command button on the form, which will cause a system folder picker to display. Upon selecting a location and hitting OK, the report in the database gets exported to that location as a PDF named according to the report's caption. The code in the On Click event for the button is as follows:
Code:
Private Sub cmdExportReport_Click()
Dim strFolder As String
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
If fd.Show = -1 Then
strFolder = fd.SelectedItems.Item(1)
Else
Exit Sub
End If
DoCmd.OutputTo acOutputReport, "rptEmployeeBirthDates", acFormatPDF, strFolder & "\" & Report_rptEmployeeBirthDates.Caption & ".pdf"
Set fd = Nothing
End Sub
This works fine, but when I subsequently try to close the database, Access freezes and I have to shut it down using Task Manager. Now, if I open the folder picker and hit "Cancel" (no exporting going on), I have no problem. It's only if Access actually exports the report that I run into trouble.
Any ideas?
Pat
Comment