inserting values into new columns while importing from textfiles

G

Guest

i need to automate the process of importing txt files in a folder into the
same table in access.i have created a macro todo the job.the following are
the probelms that i face:
1. i need to insert values into three new cols for each row getting
inserted.one is for inserting the name of the text file and the other two are
for current date and time.
2.i need to set the primary key as a combination of four cols( the above
three and a PID col that will be present in the text file.)
could any body help me out???
 
G

Guest

Hi

You could import the file into a temp table then run an append query (make
any changes you need to with this query) then delete the temp table.
 
G

Guest

what do you mean when you say append?? is it appending to the end of the db
or appending o each and every row in the table??? hows that done?
 
G

Guest

Hi

It quite simple to do. If I understand you right, you have some files
(records) somewhere on a drive and you want to add these records to a table
in an access DB but you also want to alter some of the data before it is
added to the table.

If this is on the right lines check out this link (it's a post I did a while
ago). You need to alter the code a little as it is for bringing records from
an extranal access DB into another access DB. So you will need to look at
the this section of the code

DoCmd.TransferDatabase acImport, "Microsoft Access", "Path to
ExternalDatabase.mdb", acTable, " tblOldExport ", " tblImportAppend "

and alter it for the file type and path

Make the change to the data in the append query.


http://groups.google.com/group/micr...82d9b1c59de?lnk=st&q=&rnum=2#8736182d9b1c59de
 

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