Soundsmith
Programmer
I have a function for importing a text file. The file is to be received as a line by line import into a table "tblImport", two fields, ID as AutoNumber field and F1 for te actual text in the file line by line.
This function works perfectly as written, (I've left out the error handling routines for clarity) however I need to incorporate a dialog bog for allowing the user to select the file (which could be named anything, with any extension or none. If necessary, I could convince the sender to use the '.txt' suffix, but the filename is subject to change periodically.
I had expected to pass the filename to the function, but I cannot find a simple method to open a 'select file' dialog.
I've tried the common files calls in the FAQ, but can't get them to work (I believe I don't have the proper libraries activated, but I can't find anything that references 'Common', and the ActiveX libs didn't work.
Is there a way to use something like DoCmd.RunCommand acCmdImport to achieve the desired result? Or some other function I haven't seen?
Thanks
David 'Dasher' Kempton
The Soundsmith
Code:
Public Function xferFile() As Boolean
Dim xferName As String
Dim fullnam As String, fname as String, theFile As String
fname="d:\adbm4\bvmonr.txt"
xferFile = True
fullnam = Trim(fname)
theFile = "tblImport1"
DoCmd.TransferText acImportFixed, "Bvmonr Import Specification", theFile, fullnam, False
End Function
This function works perfectly as written, (I've left out the error handling routines for clarity) however I need to incorporate a dialog bog for allowing the user to select the file (which could be named anything, with any extension or none. If necessary, I could convince the sender to use the '.txt' suffix, but the filename is subject to change periodically.
I had expected to pass the filename to the function, but I cannot find a simple method to open a 'select file' dialog.
I've tried the common files calls in the FAQ, but can't get them to work (I believe I don't have the proper libraries activated, but I can't find anything that references 'Common', and the ActiveX libs didn't work.
Is there a way to use something like DoCmd.RunCommand acCmdImport to achieve the desired result? Or some other function I haven't seen?
Thanks
David 'Dasher' Kempton
The Soundsmith