I have used the following code to select a file to upload into Access. Usually there is a specific text file type delimited, fixed etc. but with this it could come in many different formats is there a way to just have one command button on the form and run this code and have it pck what type of text file it is?
Public Function ImportTxtFiles()
Dim fd As FileDialog Dim FilePath As String Dim strName As String
Set fd = Application.FileDialog(msoFileDialogFilePicker) With fd .Title = "Select Text File to upload" .Filters.Add "Text File", "*.*" If .Show = -1 Then FilePath = .SelectedItems(1) End With Set fd = Nothing If FilePath = "" Then MsgBox "No file selected", vbExclamation, "Aborting" Exit Function End If strName = InputBox("Enter name") With DoCmd
'.TransferText , , strName, FilePath, True
End With End Function
|