Hello,
Does anyone know how I can delete all records from a table using code, while not harming the table format?
Thank you, MaryF
Douglas J. Steele - 30 Jun 2004 01:17 GMT
A Delete query will do this.
Add the table to the query builder then select Query | Delete query from the
menu.
The SQL will look like:
DELETE FROM TableName

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> Hello,
> Does anyone know how I can delete all records from a table using code, while not harming the table format?
> Thank you, MaryF
Marc - 30 Jun 2004 01:18 GMT
DoCmd.RunSQL "DELETE * FROM tempOpen;"
Marc
> Hello,
> Does anyone know how I can delete all records from a table using code, while not harming the table format?
> Thank you, MaryF
MaryF - 30 Jun 2004 01:29 GMT
Thank you Mark and Doug!!! It worked perfectly!! :)
Mary
> DoCmd.RunSQL "DELETE * FROM tempOpen;"
>
[quoted text clipped - 4 lines]
> while not harming the table format?
> > Thank you, MaryF
GVaught - 30 Jun 2004 01:29 GMT
You can create a delete query. Add the table to the query, set the field
entry to * rather than individual fields and keep the criteria section
empty. This will delete ALL the data and not the structure of the table.
Note: This is permanent and can not be undone, so you must make sure this is
what you really want to do.
The query once created can be connected to a command button which can be
executed upon clicking if you need this on a continual basis, such as
removing the content from a temporary table in order to add new records to
be processed.

Signature
G Vaught
> Hello,
> Does anyone know how I can delete all records from a table using code, while not harming the table format?
> Thank you, MaryF
MaryF - 30 Jun 2004 01:40 GMT
Thank you too, GVaught, for your helpful reply. I really appreciate all of the assistance I received. :0) Mary
> You can create a delete query. Add the table to the query, set the field
> entry to * rather than individual fields and keep the criteria section
[quoted text clipped - 11 lines]
> while not harming the table format?
> > Thank you, MaryF