HOW CAN I GROUP RECORD THAT BELONG TO THE SAME SET

G

Guest

I am import data from a text file, I wish to place the file onto access,
the txt file looks like this

LINK NAME LINK # PROCESSOR SLC SLS COMLIN
..............

TEST1 21 32 0 1
5
40 1
16 27
X X
X X etc
. .
. .
test2 31 1 2 18
197
3 4
7 23

the processor slc etc can be 32 rows long max and 1 min, these fields are
all tied into the link name and link #. I would like to be able to import
this file into access and group sort count and keep them altogether
 
T

Tom Ellison

lawson said:
I am import data from a text file, I wish to place the file onto access,
the txt file looks like this

LINK NAME LINK # PROCESSOR SLC SLS COMLIN
.............

TEST1 21 32 0
1 5
40
1 16 27
X
X X X etc
test2 31 1 2
18 197
3
4 7 23

the processor slc etc can be 32 rows long max and 1 min, these fields are
all tied into the link name and link #. I would like to be able to import
this file into access and group sort count and keep them altogether
 
T

Tom Ellison

Dear Lawson:

The data are apparently stored without repeating the LINK NAME and LINK#.
You would not be able to import this directly using a query. You can write
a VBA procedure to do this, and it can preserve the values in those two
columns and repeat them in subsequent rows where they are missing.

(Actually, there is a query solution to this, but it's more complex and
depends on certain tricks).

Start out by writing a procedure that opens the text file, reads through it
line by line, and closes the file. Then add the substring MID() function to
split out the columns. Whenever LINK NAME and LINK # are blank, replace
them with the previous values which you must save whenever they are not
blank.

Finally, having opened a recordset on the destination table, add the code to
set the columns and save the record.

Tom Ellison
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top