Delete Query Over-Zealous

G

Guest

I have a table to keep track of volunteers among others (a couple of
relationships also). After each day I click a homemade menu to Update files
and make backups. I use Append querys to make master files, CopyObject for
backups and then I want to clean out the daily files so I created a Delete
query. The SQL is very simple - DELETE Volunteers.* FROM Volunteers.
(VolunteerID, VolName, VolDate, Voltimein, Voltimeout) But when I run it from
VB it gives error message Can't delete table 'volunteers' because of
relationships. From the code I'm obviously not trying to delete the table
but the records in it. I can go into the table itself and delete the records
by hand(highlighting all records, right clicking and click 'delete record')
and I can open the query from the database window and it deletes the records
in the table with no problem; so the query works. So why won't it run from
VB. The statement I use is - DoCmd.Openquery "Start fresh Volunteers" (the
name of the query) - I don't think I need the acNormal or acEdit options??
Any suggestions ?? Is there some other command I should be using...I thought
OpenQuery worked with all querys.
 
M

[MVP] S.Clark

Is there a relationship between Volunteers and any child table?
Is Referential Entegrity selected? Is Cascade Delete selected?
 

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