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 / Queries / November 2007

Tip: Looking for answers? Try searching our database.

Deleting all data from B_E database tables. (AC2003)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bUncE - 26 Nov 2007 14:40 GMT
Hi all,

Im trying to write a query so that all data in all but two tables is
deleted, not the tables themselves only the data.

I keep getting these errors when im trying to build a suitable query..

COULD NOT DELETE FROM SPECIFIED TABLES
or
TOO MANY FIELDS DEFINED

With any luck i'd like to able to have this query run automatically each day
is there any way to do that or do i have to repost in vba section?

Thanks for reading!!
Jeff Boyce - 26 Nov 2007 14:56 GMT
We aren't there.  We can't see what you've already tried.

Please post the SQL statement of one of your DELETE queries.

Signature

Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP
http://mvp.support.microsoft.com/

Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

> Hi all,
>
[quoted text clipped - 11 lines]
>
> Thanks for reading!!
Allen Browne - 26 Nov 2007 15:00 GMT
You can't do that with a single query.

You could do it with a series of Executes in VBA code, e.g.:
   Dim db As DAO.Database
   db.Execute "DELETE FROM Table1;", dbFailOnError
   db.Execute "DELETE FROM Table2;", dbFailOnError
   'etc.

However, you will need to bear in mind the way your relationships work. If
there is a one-to-many relation between Table1 and Table2, the above will
fail because the Table1 records cannot be deleted while the Table2 records
exist (unless you have set up cascading deletes.)

You may need to ensure you don't have circular cascading deletes on your
tables.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Hi all,
>
[quoted text clipped - 12 lines]
>
> Thanks for reading!!
Dale Fye - 26 Nov 2007 16:53 GMT
I'm not sure I understand the purpose of having a database if you are going
to delete all of the data every day.  Can you explain why you think you need
to do this?

Dale
Signature

Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.

> Hi all,
>
[quoted text clipped - 11 lines]
>
> Thanks for reading!!
 
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.