Office Compatibility Issues

Fix CommonDialog File Open Errors in Access 2019

Huda QurayshiHuda Qurayshi Nov 14, 2026 868 views

Question details

Replace an obsolete CommonDialog control so a migrated Access database can open a file picker.

Product
Microsoft Access 2019
Device & OS
Windows 10
Scenario
An Access 2002 database migrated to Access 2019 uses a button to browse for a file.
Observed behavior
Clicking the button produces an “Object doesn't support this property or method” error, although the DLL and OCX files appear to be installed.
Before you start

Open the database and identify the button's On Click event procedure and the field or control that should receive the selected path. In Access, check File > Account > About Access to see whether your installation is 32-bit or 64-bit.

Solution 1Recommended

Replace the CommonDialog control with Application.FileDialog

Use Access's built-in file picker instead of the obsolete MSComDlg.CommonDialog.1 control.

1
Open the button event

Open the form in Design View, select the file dialog button, and open Property Sheet > Event. Next to On Click, select [Event Procedure] and click the build button to open its VBA code.

2
Replace the dialog code

Replace the statements that call the old CommonDialog control with the following code inside the existing Click procedure: Dim dlg As Object Set dlg = Application.FileDialog(3) With dlg .AllowMultiSelect = False If .Show = -1 Then Me.txtFilePath = .SelectedItems(1) End If End With Set dlg = Nothing Replace txtFilePath with the name of the form control that should receive the selected path. The value 3 selects the file picker.

3
Compile and test

In the VBA editor, select Debug > Compile, then save the changes. Open the form in Form View, click the button, and select a file to confirm its path appears in the target control.

Browsing for a folder: For a folder picker, use Application.FileDialog(4) instead. Check other procedures that use the old control before removing it from the form.
Free Microsoft Office alternative

Work with exported Access data in WPS Spreadsheets

WPS Office is a free, lightweight Office alternative with a familiar interface and support for common Microsoft Office formats. Export suitable Access tables to Excel to move data into WPS Spreadsheets; WPS does not fix Access errors or replace Access database forms and VBA functionality.

Review and edit data exported from Access tables as spreadsheets.Open and save Microsoft Excel XLSX files for easier migration.Use a familiar spreadsheet interface in a lightweight Office suite.Work with common Microsoft Word and PowerPoint formats.
microsoft office alternative - wps office

Frequently Asked Questions

Why does the old CommonDialog control fail even when its files are installed?

The migrated code relies on an obsolete control whose availability or compatibility may differ in Access 2019. Replace the control calls in the button's On Click procedure with Application.FileDialog.

How can I let users select a folder instead of a file?

In the button's VBA event procedure, use Application.FileDialog(4) for a folder picker. After Show returns -1, read the selected folder from SelectedItems(1).

Does 64-bit Access require changes to every VBA declaration?

Review Windows API Declare statements, not every VBA statement. Add PtrSafe where applicable and use LongPtr only for pointer-sized values required by the API signature.

What happens if the user cancels the file picker?

FileDialog.Show does not return -1 when the dialog is canceled. Keeping the SelectedItems(1) assignment inside the If .Show = -1 Then block prevents the code from reading a selection that does not exist.