Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / June 2004

Tip: Looking for answers? Try searching our database.

Delete Records with Code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MaryF - 30 Jun 2004 00:57 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.