Office Apps Not Opening

Fix a Microsoft Access Database That Opens and Closes Immediately

Tauseeq MagsiTauseeq Magsi Nov 20, 2026 870 views

Question details

Find out why a Microsoft Access database closes immediately after opening.

Fix a Microsoft Access Database That Opens and Closes Immediately
Product
Microsoft Access
Device & OS
not provided
Scenario
The user needs to open an Access application and diagnose its startup routine.
Observed behavior
The application opens and closes without displaying an error.
Before you start

Locate the database file and make sure you have permission to open it and inspect its VBA code. The Shift-key bypass may not work if the database administrator has disabled it.

Solution 1Recommended

Bypass startup and step through the Access VBA routine

Use this method to identify the statement that triggers the application's shutdown.

1
Bypass startup actions

Hold Shift while opening the database file in Access, and keep holding it until the database opens. This bypasses startup actions when the Shift-key bypass is enabled.

2
Open the VBA editor

Press Alt+F11 and locate the startup function, such as ApplicationStart, in the project. Find any error handler that calls DoCmd.Quit or otherwise closes the application.

3
Run the startup function

Place the cursor in the startup function and press F8 to step through it, supplying any required arguments if prompted. Continue through the procedures it calls until you reach the failing statement.

4
Inspect the original error

In the VBA editor, use Tools > Options > General and temporarily select Break on All Errors if the error handler hides the failure. Step through the routine again, record the error message, and restore the previous setting afterward.

Bypass startup and step through the Access VBA routine
If Shift does not bypass startup: The bypass may be disabled. Ask the database administrator for a way to open the database without its startup actions.
Free Microsoft Office alternative

Use WPS Office for Everyday Documents and Spreadsheets

WPS Office is a free, lightweight alternative for everyday office work, with a familiar interface and Microsoft Office format compatibility for easier migration. It does not repair or run Microsoft Access databases.

Work with spreadsheets when a database is not neededOpen and edit common Microsoft Office formats, including DOCX, XLSX, and PPTXUse a familiar interface for documents, spreadsheets, and presentationsGet started with a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Access database close without showing an error?

A startup procedure may encounter an error and call a shutdown command from its error handler. Hold Shift while opening the database, then step through the startup VBA code to find the failing statement.

What if holding Shift does not bypass Access startup?

The database may have the Shift-key bypass disabled. Contact the database administrator for access to the startup code or another way to open the database without running its startup actions.

How can I see the SQL generated by my Access VBA code?

Add Debug.Print strSQL before the execution line, then press Ctrl+G in the VBA editor to view the printed statement in the Immediate window. You can copy it into a new Access query's SQL View for inspection.

Why should I check gs_User_ID before the UPDATE query?

A Null, unexpected, or incorrectly typed user ID can cause the generated UPDATE statement to fail. Pause before the query and inspect gs_User_ID in the VBA editor's Locals or Immediate window.

Can WPS Office fix an Access startup error?

No. The Access database and its VBA startup code must be diagnosed in Microsoft Access. WPS Office can be used separately for compatible documents, spreadsheets, and presentations.