I looked pretty hard, but could not find a message that directly solves my problem.
The following code for the form I created works in Access 2003, which I use at work.
Dim FileName As FileDialog Set FileName = Application.FileDialog(msoFileDialogFilePicker) Dim Name As Variant With FileName .AllowMultiSelect = False .Show If .SelectedItems.Count = 0 Then MsgBox "No file selected." Exit Sub End If End With For Each Name In FileName.SelectedItems FileNameTextBox.Text = Mid$(Name, InStrRev(Name, "\") + 1) Next Name
However, when I tried to run the same code in the Access 2010 form on my personal computer, it did not work. The error message highlights the first line and says, "The user-defined type is not defined." I also tried declaring FileName as Office.FileDialog , but no luck. I have a Microsoft Access 14.0 Object Library as one of the links used, so I donβt know what is wrong with this.
I only use Access for two weeks, and all my knowledge comes from googling, so it is very likely that I am missing something obvious.
Emily
source share