Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dialog box to select file for import

Status
Not open for further replies.

Soundsmith

Programmer
Feb 21, 2001
84
US
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.

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
 
Did you do a keyword search and try the solutions offered. I posted some code a while back in the following thread705-74074 that seems to work. Terry M. Hoey
 
I did do a search, but didn't find that post because the keywords were different. However, it uses Common Dialog calls. There were other posts I did find that use Common Dialog calls, but I can't determine (or perhaps find) the libraries to include so these functions are available.

What library needs to be active for Windows Common Dialog? I have none by that or any similar name. I tried the ActiveX dialogs, with no result.

Thanks. David 'Dasher' Kempton
The Soundsmith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top