First, go to the following web site, copy the
vba code, and paste it into a module in your database:
http://www.mvps.org/access/api/api0001.htm
Next, create and save an import specification for the file you want to import.
Last of all, create a command button that calls the open dialog box and then does the file transfer. (Below is an example!)
Sub ImportFile()
'Browse and select the file to import
Dim strFilter As String
Dim lngFlags As Long
Dim SelectedFile As String
SelectedFile = ""
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
SelectedFile = ahtCommonFileOpenSave(InitialDir:="C:\", Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags)
'Now, do the file transfer
DoCmd.TransferText acImportDelim, "Your Import Specification file name goes here", _
"your table name goes here", SelectedFile, True, ""
End Sub
Before actually transferring the file, you'll probably want to use a message box to confirm the user's file selection. (It would make for cleaner programming!)
Hope this helps!