Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execution of this application has stopped due to a run-time error

Status
Not open for further replies.

RickSchadt

Technical User
Dec 8, 2009
7
US
I have the following code that takes the user to a sub-directory that allows them to pick a file. It works in native Access 2002, but when I create a runtime application and attempt to invoke on the same computer that I typically run the native database I get the error listed in the subject.
Any ideas?

Private Sub cmdFileDialog2_Click()

'Requires reference to Microsoft Office 10.0 Object Library.

Dim fDialog As Office.FileDialog
Dim varFile As Variant

'Clear listbox contents.
Me.EmailList.RowSource = ""

'Set up the File Dialog.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
'Allow user to make multiple selections in dialog box by setting to True
.AllowMultiSelect = False

'Set the default dir and/or file
.InitialFileName = "\\bas\brkfiles\CreditMainData\Blast Communication\Blast Email"


'Set the title of the dialog box.
.Title = "Please select one or more files"

'Clear out the current filters, and add our own.
.Filters.Clear
.Filters.Add "All Files", "*.*"

'Show the dialog box. If the .Show method returns True, the
'user picked at least one file. If the .Show method returns
'False, the user clicked Cancel.
If .Show = True Then
'Loop through each file selected and add it to our list box.
For Each varFile In .SelectedItems
Me.EmailList.AddItem varFile
Next
Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End With
End Sub
 
Your first step should be to add some error handling, so you can trap the error num and desc. Once you have these, you will know how to proceed further.

The three most dangerous things in the world are a programmer with a soldering iron, a hardware type with a program patch, and a user with an idea.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top