Re: Exporting table to .csv file, then importing .csv file back to

Tech-Archive recommends: Fix windows errors by optimizing your registry



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.

.



Relevant Pages

  • Re: finding data
    ... My question is how do I set up this database so when you open iti you ... In form design view make sure the Toolbox wizard is enabled (magic wand ... This will be the third choice in the first page of the ComboBox ... Rick Brandt, Microsoft Access MVP ...
    (microsoft.public.access.tablesdbdesign)
  • RE: Import Spreadsheet error
    ... navigating to the file's directory with the Import Text Wizard? ... you may use this one for importing the CSV file. ... See http://www.QBuilt.com for all your database needs. ... >> you time and grief, ...
    (microsoft.public.access.externaldata)
  • Re: transfer data into an external database
    ... >With regards to your SQL code I have no idea about SQL. ... If there is a schema.ini in the same folder as the CSV file, ... >> Create a Schema.ini file based on an existing table in your database: ... John Nurick ...
    (microsoft.public.access.externaldata)
  • RE: Import Spreadsheet error
    ... CSV file, but when I go to import it, my drop down box does not file types ... > _much_ faster than importing XLS files (the Wizard has to dig through a lot ... > adds your question and the answers to the database of answers. ...
    (microsoft.public.access.externaldata)
  • Re: Adding new users
    ... Keep track of it on your own and part of the documentation you have for the database. ... I can see the explanations in the wizard if I use it. ... :> Joan Wild ... :> Microsoft Access MVP ...
    (microsoft.public.access.security)