Re: Exporting table to .csv file, then importing .csv file back to
- From: rapieriiia <rapieriiia@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 13 Mar 2007 08:22:13 -0700
Hi John,
Thanks for your reply, I can make sense of the code, and understand what I
need to change to make it work with my database, but as I said I am very new
to this...
This probably sounds totally stupid, but where do I type this code in? Is it
somewhere in the macro screen?
Sorry for being dumb, but I guess everyone started somewhere?
Nick.
"John Nurick" wrote:
Hi Nick,.
To export the data in a table to a CSV file in a fixed location, just
use
DoCmd.TransferText acExportDelim, , "MyTable", _
"D:\Folder\File.txt", -1
To re-import, just delete all the records from the table and use
TransferText again
CurrentDB.Execute "DELETE * FROM MyTable;", dbFailOnError
DoCmd.TransferText acImportDelim, , "MyTable", _
"D:\Folder\File.txt", -1
There are lots of possible complications, especially if you are using
relational integrity.
On Mon, 12 Mar 2007 14:36:38 -0700, rapieriiia
<rapieriiia@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I’m sure that this task is rather easy really, but when you haven’t got the
first clue anything can seem hard!
I have a simple database that is going to be used in conjunction with a
‘batch terminal’ type barcode scanner for stock control purposes.
I have used the wizard within MS Access 2000 to export to a csv file, and I
have managed to make it work as desired with my barcode scanner. Also, I have
managed to import it (although this was slightly trickier).
What I ideally need is a way (macro perhaps?) to export the entire table to
the .csv file (to a predefined location, with a predefined name) without
having to use the wizard, but instead just by clicking an item from the
switchboard.
Also, I need a similar way to get the new data back into the database,
bearing in mind that the imported data will need to overwrite the existing
table contents.
Any help with this would be gratefully received. Please be as specific as
possible, as I’m only just learning the whole database thing! I think at some
point soon I’m going to have to really study SQL and VB…
Thanks in anticipation.
Nick.
--
John Nurick [Microsoft Access MVP]
Please respond in the newsgroup and not by email.
- Follow-Ups:
- Re: Exporting table to .csv file, then importing .csv file back to
- From: John Nurick
- Re: Exporting table to .csv file, then importing .csv file back to
- References:
- Re: Exporting table to .csv file, then importing .csv file back to tab
- From: John Nurick
- Re: Exporting table to .csv file, then importing .csv file back to tab
- Prev by Date: Re: Exporting table to .csv file, then importing .csv file back to tab
- Next by Date: Re: Editing Links to Excel Files
- Previous by thread: Re: Exporting table to .csv file, then importing .csv file back to tab
- Next by thread: Re: Exporting table to .csv file, then importing .csv file back to
- Index(es):
Relevant Pages
|