Convert .TXT --> .MDB

  • Thread starter Thread starter giannis
  • Start date Start date
G

giannis

I have a .txt file in the following form :

-------------------------------------------
text1
-------------------------------------------
text2
-------------------------------------------
text3
-------------------------------------------
..
..
..
-------------------------------------------
text n
EOF

How can convert this file in a .mdb file
with one field and with n records (text1,text2,...,text n) ?
 
Hi, Giannis!

First create an .mdb, then do File -> Get External
Data -> Import. In the dialog box, under Files of type
select Text Files, then select the desired textfile,
click Import, and follow the wizard.

Karcsi
 
Answered in .conversions



I have a .txt file in the following form :

-------------------------------------------
text1
-------------------------------------------
text2
-------------------------------------------
text3
-------------------------------------------
.
.
.
-------------------------------------------
text n
EOF

How can convert this file in a .mdb file
with one field and with n records (text1,text2,...,text n) ?

John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
Noooo !!! i need text1=record 1 ..... text n= record n, that is
all the lines of eatch text(text1,text2,...) in a record, that is
i need only n records.
(Access import eatch line of each text as a record)
 
I sad even that! After importing you will have about 2n
records in the Access table, but then you can run the
delete query i wrote to eliminate those records with the
lines, obtaining finally just that n records you need...

Karcsi
 
You dont understand. After importing i have (n records)x(mass of lines at
eatch text)
(because eatch text contains >1 lines !!!)

This implies that your textfile looks like this:

----------------------------
blah blah
blah stuff blah blah blah
----------------------------
blah blah thejhreh jkjk
blah stuff blah blah blah
blah kjkjkkjlj
----------------------------
blah blah trttr
blah
ajhklj
uhiuhas
ashuio
----------------------------
blah blah
blah stuff blah blah blah
blah
----------------------------

One simple way to deal with this is:

1) in a text editor (or in Word) replace all linebreaks with a tag that
does not appear anywhere in the data, for example "###"
The beginning of the file will now look like this:

----------------------------###blah blah###blah stuff blah blah
blah###----------------------------###blah blah thejhreh jkjk###blah
stuff blah blah blah###blah kjkjkkjlj###----------------------------

2) now replace all instances of ----------------------------### with a
linebreak, resulting in

blah blah###blah stuff blah blah blah###<linebreak>
blah blah thejhreh jkjk###blah stuff blah blah blah###blah
kjkjkkjlj###<linebreak>

3) import this into an Access table

4) restore the linebreaks by using an update query to replace ### in
each record with Chr(13) & Chr(10)



John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
Giannis, am I correct in thinking that your text file looks similar to
the following?


-------------------------------------------
text1 - Line 1
Line 2
Line 3
-------------------------------------------
text2 - Line 1
Line 2
-------------------------------------------
text3 - Line 1
-------------------------------------------
....
-------------------------------------------
text-n - Line 1
Line 2
-------------------------------------------

And that you need all the lines in between a set of dashes on a single
record?

Without knowing approximately how many lines you're talking about, I'd
recommend that you either step through your file and delete the
carriage returns so the lines are on one page, or write a small C++ or
VB app to do the same thing for you.

HTH

Russn
 
Thanx very much !!!!!! This is the ansewer!!!!
I create a table "Table1" with a field "p" as memo
and i import the text.
Can you write a query so update the symbol "#"
with the chr(13) ? I want it in SQL form (UPDATE ....)
I am new in SQL and i want this for a example.

John Nurick said:
You dont understand. After importing i have (n records)x(mass of lines at
eatch text)
(because eatch text contains >1 lines !!!)

This implies that your textfile looks like this:

----------------------------
blah blah
blah stuff blah blah blah
----------------------------
blah blah thejhreh jkjk
blah stuff blah blah blah
blah kjkjkkjlj
----------------------------
blah blah trttr
blah
ajhklj
uhiuhas
ashuio
----------------------------
blah blah
blah stuff blah blah blah
blah
----------------------------

One simple way to deal with this is:

1) in a text editor (or in Word) replace all linebreaks with a tag that
does not appear anywhere in the data, for example "###"
The beginning of the file will now look like this:

----------------------------###blah blah###blah stuff blah blah
blah###----------------------------###blah blah thejhreh jkjk###blah
stuff blah blah blah###blah kjkjkkjlj###----------------------------

2) now replace all instances of ----------------------------### with a
linebreak, resulting in

blah blah###blah stuff blah blah blah###<linebreak>
blah blah thejhreh jkjk###blah stuff blah blah blah###blah
kjkjkkjlj###<linebreak>

3) import this into an Access table

4) restore the linebreaks by using an update query to replace ### in
each record with Chr(13) & Chr(10)



John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
Back
Top