Macro to delete all but a few fields in a table

mjwillyone

Registered User.
Local time
Today, 13:40
Joined
Aug 3, 2004
Messages
27
Friends,

My web site uses contact data from an Access database I created. Due to security concerns, I don't want all of the tables, forms, queries, etc. uploaded to the web site. I am going to use Winbatch to handle automation of this process but need a macro (or other programming) to take care of the following for me:

1) Delete all but these fields in the table: ProjID, FirstName, LastName, Country

2) Export this changed table to another Access database, so that ONLY this table is in the new database.

Can anyone help in this? I would think that I simply need a macro or some other programming that is coded into the original database. I have already created the Winbatch routine that will save a working copy of the database so the original will not experience any change to it. The Winbatch routine will also automatically upload the changed database to our web site.

Thank you in advance for any help you can give. It is most appreciated!

Mike
 
There may be a better way, but you can just create a maketable query with the fields you want and then run it to create the new table (with just the fields you want) and then use the DoCmd.TransferDatabase command to copy the table to the other database.
 
in fact you dont even need the make table. just create a select query with the fields you want and export that directly.

DoCmd.TransferDatabase acExport, "Microsoft Access", "Path and name of DB to Export to ", acTable, "Name of query exporting from", "name of table in DB going into", False

or use TransferDatabase in the Macro builder and just fill in the fields


HTH

Peter
 

Users who are viewing this thread

Back
Top Bottom