S
Sash
Time to call in the experts!! I'm calling the function Frame50_File (code
below) to select a file to be imported into my database. What happens is it
opens explorer and I select the file. The explorer screen appears again and
when I select the file a second time it works. I tried putting break points
in the function and I can't figure out why it works the second time, but not
the first.
The section of code used to call the function:
Call Frame50_File
Filename = Frame50_File()
If Filename = "" Then Exit Sub
Function:
Public Function Frame50_File() As String
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "Select Import File"
.Filters.Clear
.Filters.Add "Text", "*.txt"
.Filters.Add "All Files", "*.*"
.FilterIndex = 1
.AllowMultiSelect = False
.InitialFileName = "\u:interfaces/import/"
result = .Show
If (result <> 0) Then
Returnfilename = Trim(.SelectedItems.Item(1))
Else
MsgBox "No file selected"
Returnfilename = ""
Forms!MainForm.[Frame50] = Null
End If
If Returnfilename = "" Then
Exit Function
Else
Frame50_File = Returnfilename
End If
End With
End Function
below) to select a file to be imported into my database. What happens is it
opens explorer and I select the file. The explorer screen appears again and
when I select the file a second time it works. I tried putting break points
in the function and I can't figure out why it works the second time, but not
the first.
The section of code used to call the function:
Call Frame50_File
Filename = Frame50_File()
If Filename = "" Then Exit Sub
Function:
Public Function Frame50_File() As String
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "Select Import File"
.Filters.Clear
.Filters.Add "Text", "*.txt"
.Filters.Add "All Files", "*.*"
.FilterIndex = 1
.AllowMultiSelect = False
.InitialFileName = "\u:interfaces/import/"
result = .Show
If (result <> 0) Then
Returnfilename = Trim(.SelectedItems.Item(1))
Else
MsgBox "No file selected"
Returnfilename = ""
Forms!MainForm.[Frame50] = Null
End If
If Returnfilename = "" Then
Exit Function
Else
Frame50_File = Returnfilename
End If
End With
End Function