Appending text data to existing table

R

Richard

I have two tab delimited text files that I need to add.

What is best way to create table that combines the two tables?

I could use "DoCmd.TransferText acImportDelim" type command, but I don't
know how to add data to existing table.
Or I could simply import both text files into separate tables, but I don't
know way to simply add the two tables together.
 
J

John Spencer

When you specify the table name or and existing table in transfer text the
data that is imported is APPENDED to the table.

Docmd.TransferText acImportDelim, specificationNameasstring,
tableNameasString, FilenameAsString.

Check out the help for the transferText Action.
Quote
Table Name
The name of the Access table to import text data to, export text data from, or
link text data to. You can also type the name of the Access query you want to
export data from. This is a required argument.

If you click Import Delimited, Import Fixed Width, or Import HTML in the
Transfer Type box, Access appends the text data to this table if the table
already exists. Otherwise, Access creates a new table containing the text data.
End quote

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
 
R

Richard

John,
You are right about the append part (not sure why it wasn't doing earlier).
However, the problem I'm having now is getting Access to automatically
assign index numbers.
When I manually input, using what you call specificationNameasstring, it
does assign an index. But when I do it from macro, the index number are
absent.
 
J

John Spencer

I do not know what you mean by an index number. If you are referring to
an autonumber field, then that should be created no matter how you enter
records - import, typing, pasting, queries, etc.


What version of Access are you using?
'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
R

Richard

John,
Access calls the index number a 'primary key'. During a manual input, one of
the options is "let Access assign a primary number"
I need the primary key to exclude data based on most recent date.

I'm running Access 2003
 

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