Import multiple fix width txt files and eliminate multiple headers and footers (1 Viewer)

NewGuy23

New member
Local time
Today, 10:56
Joined
Aug 2, 2013
Messages
2
I am trying to build a newer database 2010, based on an older one,2000, that has been locked tight and I cannot see the modules to kinda get a reference of where to start. I am trying to find a VBA code that will allow me to import a several text files to one table. The text files are all in the same format but I cannot remove the page headers and footers to get the table to look right. I have attached an example of the text file i am trying to import but it is a stripped down version for information protection.

Also, it appears in the old Database Table once imported as:

J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date

If I could import the text files and end up with a table like this, it would be all i need as i could run all the queries i need from this. Any help anyone can offer I would really greaty appreciate it.

Thanks
 

Attachments

  • Example Text File.txt
    2.4 KB · Views: 103

Mihail

Registered User.
Local time
Today, 19:56
Joined
Jan 22, 2011
Messages
2,373
Step by step:
- Open the attached .xls file
- Ensure that you are in shCopy sheet and the top left cell (A1) is selected

- Open the .txt file
- Select ALL (CTRL+A)
- Copy (CTRL+C)

- Switch to Excel
- Paste (CTRL+V)
- Run the macro

It is all I can do this time because I haven't a pattern for more data in the .txt file that you have uploaded.
For example I don't know if "NONE" under the STATUS DATE field should be replaced or not.
Also I don't know if the dates values should be converted or not.

And I don't know exactly the fields length (size).
For example, here "Smith John.........01234" are 24 characters, but where exactly is the end of the name and where start the number ? How this looks if the name is "Smith John jr" ?
 

Attachments

  • NewGuy23.xls
    37.5 KB · Views: 80

NewGuy23

New member
Local time
Today, 10:56
Joined
Aug 2, 2013
Messages
2
Thank you for the reply. I was able to use the product with some adjustments. I had to manipulate the txt file i attached due to some personal information. I was really hoping for an Access 2010 VBA code do complete it but i have to use excel to create get the table ready for access i can do that as well. Also, while using the code, is there a way to input column titles, and have the name, emp #, grde, w/c center for the first real record to repeat until it gets to the next name. ie.

J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Smith 1234 01 ABCD ABCD HGJV 1234 ABCDE ABC6 Qual Date Date
J.Smith 1234 01 ABCD ABCD HGJV 5678 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 5678 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 1234DE ABC6 Qual Date Date

Thanks
 

Users who are viewing this thread

Top Bottom