Pia A Pia A - 7 months ago 16
SQL Question

#Delete error on cells when excecute Delete Queries on Access

Hei:
I have created a button where I run a group of Delete Queries on MS Access 2016 , to delete records from forms and subforms, to clean a main Form.
They have the following kind of SQL statement, to delete the records from the tables that feed my forms:

DELETE tblConfig.TenderID, *
FROM tblConfig
WHERE (((tblConfig.TenderID)=[Forms]![frmGI]![TenderID]));


When I run the queries, actually delete all the records from my tables but I get a #Deleted in all the deleted cells.Is there a way to make this dissappear?
I have googled the error, but have had no success on finding an answer.
Any ideas

Answer

You are on a specific record within the form ([frmGI].[tenderID]), which you then delete, so you will see the #deleted. If you delete a record, you will have to move to a new record or a different record.

If you are deleting subform records then you will need to requery your subform.

EDIT:

To requery your subform use the following code syntax and insert after the queries have been taken place. The #deleted on a subform is due to a refresh taking place on the subform. Refresh and requery are not the same.

Forms!tblconfig.Form![subformName].Requery