FileDialog doesn't work
The FileDialog
object is not provided by the Access library, but by the Office library. So your code should work if you set a reference to the Microsoft Office [version number] Object Library. Either you don't have that reference set, or it's broken.
However if it were me, I would leave the reference unset and modify the code like this. See if it works for you.
Const msoFileDialogFilePicker As Long = 3Dim objDialog As ObjectSet objDialog = Application.FileDialog(msoFileDialogFilePicker)With objDialog .AllowMultiSelect = False .Show If .SelectedItems.Count = 0 Then MsgBox "No file selected." Else Me.FileNameTextBox.Value = Dir(.SelectedItems(1)) End IfEnd With
In tools, references..., you have to select "Microsoft Office 14.0 Object Library" instead of the Microsoft Access one.