Please try this and tell me what you think

  • Thread starter Thread starter George Hester
  • Start date Start date
G

George Hester

Open an Access 2002 Database mdb. Open any table with text data with at
least more then four records. Select three records at once. This is done
by selecting one record amd then while holding the Shift key down select
another record two records below. You now have three records selected.
Move the mouse over to right a little bit and when the mouse changes to just
a vertical line, right click and choose copy. Now minimize Access 2002.
Open notepad; Start | Run | notepad | OK. Go to Edit | Paste. You will see
that the filed names of the table appear as well as the records you chose.
Also note that although the data in the table was text, you do not see
quotes "" surrounding the text data as pasted into Notepad.

Now what happens for me is that I do this programmatically writing the
records into a text file. But the records when written programmatically
using FileSystremObject appear in the Text file with "" quotes surrounding
the pasted records. This sucks because then I have to go through the entire
text file removing "" quotes and that takes time. I would like the text
from the database to be written to the text file programmatically in JUST
EXACTLY the way the data records are written to the text file as I showed
you above in my little "please try..."

Can it be done? And if so how? Thanks.
 
George Hester said:
It's too long. I cannot inflict that on this group. Let me just explain
what is happening and then you can try it out for yourself if you are so
inclined.

Thank you. ( I think you are wise!) A short 5 or 10 lines is ok, but not one
big hunk of code.

Why don't you dump all that linking stuff, and simply use the transfer text
command?

You can build a import/export spec, and in that things like using "quotes"
to surround text etc can be controlled. So, what you do is select that query
and then go file-Export.

Export the data as a text file, and save the import spec.

You then can create the whole transfer by using transfer text, and not used
a linked table.

Thus, once the above works as manual process, you then use:

docmd.TransferText

(check out transfer text in the help).
 
Thanks Albert. I will give that a go. That really sounds like the way to
go. I never really liked this Linked table to tell you the truth. Darn
thing does work well accept for this quotes issue. See I have to sort the
Linked table each time more data is written to the table. It has no Primary
key and even if it did, a sort using the Primary key (even if it were
possible - which it ain't) that alone would take too much time. So I set it
up this way:

Updated Raw data table -> Full table (Updated Raw data table + Linked table)
sorted by SQLQuery (is new each time and dups removed) -> Linked Table
(remove data in text file it's linked to) -> Refresh -> Bring in Full table
(append Full table to Linked table) -> Refresh -> Remove quotes from
resulting text file -> Refresh Linked table and write text file to a ASCII
file without extension. The result is a no dups sorted non-extension ASCII
file

So I will try to squeeze your suggestion into this. Thanks.
 
Back
Top