Others

Troubleshoot Microsoft Access Closing During OutputTo PDF Export

Elise WilliamsElise Williams Nov 13, 2026 869 views

Question details

The user needs to determine why a Microsoft Access database closes during a startup report-to-PDF export and prevent it from closing before subsequent code runs.

Troubleshoot Microsoft Access Closing During OutputTo PDF Export
Product
Microsoft Access
Device & OS
Windows 10; exact Windows and Microsoft Access versions not provided
Scenario
A startup form's On Load event calls OutputTo to export a report as a PDF with a specific OutputFile path. Behavior may differ when the database is launched manually or through Task Scheduler.
Observed behavior
The database closes before later code executes on some computers, while the same workflow completes successfully on the client's computer.
Before you start

Record the exact OutputFile path, Access version, Windows build, and launch method on an affected computer and a working computer. Confirm whether only the database closes or the entire Access application exits.

Solution 1Recommended

Isolate the OutputTo call and test the destination path

Use a minimal manual test to determine whether the export call or its destination triggers the closure.

The reported behavior does not establish a single confirmed cause. Simplifying the startup code and changing only one variable at a time helps distinguish a path problem from an event or environment issue.

1
Inspect the startup event

Open the database while holding Shift to bypass startup actions, if bypass is enabled. Open the startup form in Design View, select Property Sheet > Event > On Load, and use the build button to inspect its event procedure.

2
Run a minimal export test

Press Alt+F11 to open the VBA editor. Copy the report's OutputTo call into a separate test procedure, keeping the same report name and PDF format. Remove unrelated operations from the test and run it manually from the editor.

3
Use an accessible local output file

Create a folder through File Explorer in a location where your account can create files. Change the test procedure's OutputFile argument to a full local filename ending in .pdf, and run the test again.

4
Retest the original destination

In File Explorer, open the original destination folder and try creating a file there. Verify that the folder exists and that an existing output PDF is not open or locked, then restore the original OutputFile path and repeat the export.

5
Check whether execution returns

In the VBA editor, set a breakpoint on the line immediately after OutputTo by clicking its left margin. Run the test and check whether that breakpoint is reached and whether the PDF was created.

Isolate the OutputTo call and test the destination path
A successful local export narrows the investigation: If a local file exports correctly but the original destination causes closure, focus on that path, permissions, file locks, and network availability. This result alone does not confirm the exact cause.
Free Microsoft Office alternative

Use WPS Office for Everyday Documents and PDF Export

WPS Office is a free, lightweight alternative for document, spreadsheet, and presentation work, with a familiar interface and Microsoft Office format compatibility for a smooth transition. It can export supported documents to PDF, but it does not run Access databases or fix Access OutputTo automation.

Export supported documents, spreadsheets, and presentations to PDF without an Access report workflow.Work with Microsoft Word .docx, Excel .xlsx, and PowerPoint .pptx formats.Use a familiar Office-style interface for everyday editing.Move supported Office files into a free, lightweight suite while keeping Access database tasks in Microsoft Access.
QA img-9

Frequently Asked Questions

Why does Access close only when I specify an OutputFile path?

The path may expose a permissions, file-locking, or network-access issue, but the reported behavior does not prove a single cause. In the VBA editor, test the same OutputTo call with a full filename in a writable local folder, then compare it with the original destination.

How can I tell whether OutputTo finishes before Access closes?

Press Alt+F11 and set a breakpoint on the line immediately after the OutputTo call. Run the export and check whether execution reaches that line. Also check the output folder for the PDF; file creation alone does not prove that subsequent code ran.

Why might the export work manually but fail in Task Scheduler?

A scheduled task may run under a different account or session and may not have the same network access or mapped drives. Open Task Scheduler > Task Scheduler Library > the task's Properties and review General, Actions, and Settings, including the run account, launch arguments, and stop conditions.

Does this mean newer Access or Windows versions have a PDF export bug?

Not necessarily. The issue was reported on some systems but not others, without a confirmed version-specific cause. Compare About Access and winver information, run the same minimal export on each system, and check Event Viewer if Access exits unexpectedly.

Can WPS Office replace this Access report automation?

No. WPS Office does not run Access .accdb or .mdb databases or their VBA report automation. For supported documents, spreadsheets, and presentations, you can use WPS Office's PDF export options, but the Access workflow still requires separate troubleshooting.