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:
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