Delete button isn't working

G

gagecres

I added a delete records button to my form. This form also contains a
subform. I've done this with no problems on several other databases. This
time the button deletes the info from the form, but not the table where it is
stored. I don't understand what is going on. Can somebody help?
 
J

John W. Vinson

I added a delete records button to my form. This form also contains a
subform. I've done this with no problems on several other databases. This
time the button deletes the info from the form, but not the table where it is
stored. I don't understand what is going on. Can somebody help?

Not without seeing the code for the button and knowing more about the tables.
Do you have referential integrity enforced between the table you're trying to
delete from and a child table (the subform's table)? If so you won't be able
to delete the parent record as long as child records exist, unless you have
Cascade Deletes checked on the relationship.
 
G

gagecres

Yes, I have referential integrity enforced as well as cascade delete related
records. I've also tried the compact and repair the database, but nothing
was wrong. When I click the delete button, that the wizard helped me create,
the data is removed from the form. But, when I go look at the tables in
which the data is stored, the data for the subform is gone but the data for
the main form is still there.
 
J

John W. Vinson

Yes, I have referential integrity enforced as well as cascade delete related
records. I've also tried the compact and repair the database, but nothing
was wrong. When I click the delete button, that the wizard helped me create,
the data is removed from the form. But, when I go look at the tables in
which the data is stored, the data for the subform is gone but the data for
the main form is still there.

Please post your code.
 
G

gagecres

It is just a macro:

Condition Action Arguments
OnError Next,
GoToControl
=[Screen].[PreviousControl].[Name]
ClearMacroError
Not [Form].[NewRecord] RunCommand DeleteRecord
[Form].[NewRecord] And Not [Form].[Dirty] Beep
[Form].[NewRecord] And [Form].[Dirty] RunCommand Undo
[MacroError]<>0 MsgBox
=[MacroError].[Description],Yes, None
 

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