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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import text files into Access 1

Status
Not open for further replies.

Orion45

IS-IT--Management
Feb 6, 2002
155
US
I have a routine set up that allows the user to browse for a local text file and then click a button to import the selected file into Access. This works great for delimited text files but I need to also allow the users to import fixed width flat files. I cannot setup a Specification file since the data being imported my vary from one use to the next.
If the selected file is a fixed width is there a way to either load the Import Wizard or dynamically setup a specification file using VBA code? Any help/comments would be appreciated. Thanks,
My code is currently as follows:
Code:
strPath = "c:\AddHocConvert.txt"
strTable = "AdHoc_temp"
DoCmd.SetWarnings False
DoCmd.RunSQL "DROP TABLE " & strTable
DoCmd.SetWarnings True
DoCmd.TransferText acImportDelim, "AddHoc_Import", strTable, strPath, 0
 
You may try this:
DoCmd.RunCommand acCmdImport

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Great! That worked.
Pink star for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top