Fix CommonDialog File Open Errors in Access 2019
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.
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.
Replace the CommonDialog control with Application.FileDialog
Use Access's built-in file picker instead of the obsolete MSComDlg.CommonDialog.1 control.
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.
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.
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.
Update Windows API declarations for 64-bit Access
Check API declarations if the migrated database also calls Windows APIs and runs in 64-bit Access.
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.

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.




