Delete Queries

G

Gregg

I have several delete queries that display the following
error message:

"could not delete from specified tables"

I've heard though a friend that I can't include multiple
tables as part of this type of action. Is this correct?
If so, how can I delete the contents of multiple tables
all at once without having to wrote code or create a
single delete query for each table? I'd like to keep all
functions in queries if possible.

Thank you for your help.
 
D

Douglas J. Steele

Are you asking whether you can delete from more than one table
simulataneously? If so, then the answer is no, you can't.

Perhaps if you explain what you're trying to do, someone will be able to
suggest an approach.
 
G

Gregg

I simply want to delete the contents of multiple tables
simultaneously using a query rather than code.
 
D

Douglas J. Steele

You can't. You must use multiple queries, one for each table. You can create
VBA code to wrap it all up in a transaction, so either all tables get
deleted, or none do.
 
K

Kayak

can u please give me example for its vba code?
my case is i have 2 tables.i want to delete its records in
one go.
 
G

Guest

Function ClearTables()

DoCmd.RunSQL "Delete * from PreProduction", -1
DoCmd.RunSQL "Delete * from PlannedOrder", -1

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top