Import text file into table problem.

YANECKC

Board Regular
Joined
Jun 13, 2002
Messages
199
I have a text file that I want to import into a table however there is a problem.
There are three kinds of detail in the text file. Each row starts with a F57 or F58 or F59.
Rows that start with F57 has a field located from byte 14 to 22. It is the Product Id.
Rows that start with F58 are not needed so I want to bypass importing those rows.
Rows that start with F59 has a field located from byte 10 to 23. It is the Quantity field.

Is there a way I can import only rows that start with F57 and F59 both only the fields I mentioned.

Example of text file below.
F57 03525809L061U720812132002
F58 0278887051610 00000114416500000000000000113AZBR00000000000001392844
F58 0278887054812 00000143198100000000000000113AZBR00000000000001392885
F590103520000000257614600000000000000000000400000002 000000000000000
F57 03525809L061U721612132002
F58 0279999653317 00000172811100000000000000113AZBR00000000000001228451
F58 0279999649315 00000431861800000000000000113AZBR00000000000001128669
F58 0279999642211 00000238095200000000000000113AZBR00000000000001117365
F590103520000000842768100000000000000000000500000003 000000000000000

=============================================
That means after import only two fields would be input into table.
First record would have L061U7208 in column Product Id and 00000002576146 in a Quantity field .
Second record would be L061U7216 for ID and 00000008427681 for Quantity.

Thank you for your anticipated response.
Yaneckc@aol.com
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Just a thought,

Define two liked tables, one with specs for F57 and one with specs for F59.

Then write a update query that filters for F57, and one that filters for F59, and puts results in an Access table.
 
Upvote 0
Is there any way when importing the text file into table that it inputs from the first row of F57 to F59 on one line then input next F57 to F59 on one line. That means the first record in the table would have the first four lines of text. The next record would have line five thru nine.
And so on.

Thank you for your anticipated response.
Yaneckc@aol.com
 
Upvote 0
If you wanted to do something like that, I would recommend combining the F57 and F59 records onto one line in Excel or some sort of text editor before trying to import into Access. I don't think you can do it on the Access side.

Otherwise, I would try the method Mr. Ed proposed.
 
Upvote 0

Forum statistics

Threads
1,221,507
Messages
6,160,219
Members
451,631
Latest member
coffiajoseph

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top