Using VBA to Append and add in an additional value (1 Viewer)

mab9

Registered User.
Local time
Today, 03:16
Joined
Oct 25, 2006
Messages
63
I'm currently using VBA's DoCmd.TransferText to import a text file into a specific. Is there a way that for each record appended in this manner, to update a seperate field in the table with a value stored in memory but isn't in the text file? For example

Text File:
Item
Description
Price

Table:
Item
Description
Price
Vendor

Each text file contains only the item, description and price, however in memory I've stored the vendor name. At the time of the append, is there a way to populate that vendor name inthe table for each of the records added from the text file?
 

tranchemontaigne

Registered User.
Local time
Today, 01:16
Joined
Aug 12, 2008
Messages
203
Given what you want to do, I'm thinking transfertext is not the method you want to use.

Read the article at

http://zmey.1977.ru/Access_To_Excel.htm

and pay special attention to ADODB and DAO techniques. I expect you could put some run time processing into these code samples to alter values before they are posted into Excel

While you are at it you might want to read

http://zmey.1977.ru/Excel_And_Autofilter.htm

to make heirarchical headers in your excel output

I like to make the headers first, then paste data into excel specifying the top left cell where the data dump should begin.

Hope this helps.
________
Zr Engine
 
Last edited:

Users who are viewing this thread

Top Bottom