Delete button isn't working

  • Thread starter Thread starter gagecres
  • Start date Start date
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?
 
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.
 
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.
 
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.
 
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
 
Back
Top