I have some code that I would like to set the path variable on within the FileDialog box. I have not been able to fig out how to setit . It defaults to the DB "default DB Folder" The following rtn works OK but its always used this def db location as the path. I want ot bea able to control that path within the code.
Any suggestions would be greatly appreciated !!!
===========================================================
Private Sub FileDialog_Click()
On Error GoTo Err_FileDialog_Click
Me.txtFilePath = "No File Selected"
Dim fname As FileDialog
Dim itm As Variant
Dim strInitialfile As String
Stop
Set fname = Application.FileDialog(msoFileDialogFilePicker)
With fname
.Filters.clear
.Filters.Add "Dat Bank Files", "*.Dat", 1
.AllowMultiSelect = False
If .Show = True Then
For Each itm In .SelectedItems
Stop
Me.txtFilePath = itm
' Stop
' DoCmd.TransferText code here ...
Next
End If
End With
Tom Moran
Lansing, Michigan
Any suggestions would be greatly appreciated !!!
===========================================================
Private Sub FileDialog_Click()
On Error GoTo Err_FileDialog_Click
Me.txtFilePath = "No File Selected"
Dim fname As FileDialog
Dim itm As Variant
Dim strInitialfile As String
Stop
Set fname = Application.FileDialog(msoFileDialogFilePicker)
With fname
.Filters.clear
.Filters.Add "Dat Bank Files", "*.Dat", 1
.AllowMultiSelect = False
If .Show = True Then
For Each itm In .SelectedItems
Stop
Me.txtFilePath = itm
' Stop
' DoCmd.TransferText code here ...
Next
End If
End With
Tom Moran
Lansing, Michigan