Working with strings

  • Thread starter Thread starter Patrick Chase
  • Start date Start date
P

Patrick Chase

Guest
I am new to Access. I have a file that I receive daily as a string of data with a specific layout. I currently use the excel MID() function to pull out the data I need and present it in more readable format. Is there any way to do this in Access so that I can create a database. Please help. Thank you so much.

Patrick Chase
 
Assuming the text file you are referring to is a fixed width file which is essentially a flat file of a table that you want to import into Access then the Import Specifications in Access should suit your requirements.

Open the database and select File / Get External Data / Import. This will bring up a window allowing you to select the location of the file. Change the 'Files of type' to text files and then locate your file. Click on import. This will bring up the import text wizard. Select 'Advanced' which will brin up a window allowing you to set up an import specification for your file. Essentially all you need to do is set the relevant details in the Field Information data grid. Set up each field you require with details of it's name, data type, start position, width, etc.. If there are particular portions of the line that you do not require then set it up as a field and tick 'Skip'. Once you have defined all the fields click on Save As and give it a relevant name. Click on Ok and then follow through the steps using Next. When you are finished you should have a table containing the records as given in the text file.

Once you have the specification file set up you can automate the import process for the future using TransferText either in code or in a macro, check the help file for further details.

DoCmd.TransferText acImportFixed, "YourSpecificationName", "YourTableName", "YourTextFile-FullPathDetails", Yes/No-FieldNamesAtTopofFile
 

Users who are viewing this thread

Back
Top Bottom