I am attempting to have the user select the folder in which to save a backup file. But, I get run-time Error 3011. Here is the code:
Dim dbs As DAO.Database
Dim fDialog As Office.FileDialog
Dim FolderName As String
Dim FileName As String
Set dbs = CurrentDb()
Set fDialog = _
Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.AllowMultiSelect = False
.Title = "Select location for backup file..."
.InitialView = msoFileDialogViewDetails
.InitialFileName = "TEMP"
If .Show = True Then
For Each FolderSelected In .SelectedItems
FolderName = FolderSelected & "\"
Next
End If
End With
FileName = "mstrarcv.txt"
DoCmd.TransferText acExportDelim, , FolderName, FileName
The error message appears on the "Do.Cmd..." line.
Dim dbs As DAO.Database
Dim fDialog As Office.FileDialog
Dim FolderName As String
Dim FileName As String
Set dbs = CurrentDb()
Set fDialog = _
Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.AllowMultiSelect = False
.Title = "Select location for backup file..."
.InitialView = msoFileDialogViewDetails
.InitialFileName = "TEMP"
If .Show = True Then
For Each FolderSelected In .SelectedItems
FolderName = FolderSelected & "\"
Next
End If
End With
FileName = "mstrarcv.txt"
DoCmd.TransferText acExportDelim, , FolderName, FileName
The error message appears on the "Do.Cmd..." line.