Determining quantity of records deleted with form

  • Thread starter Thread starter Dr. Know
  • Start date Start date
D

Dr. Know

How can you determine the number of records deleted by a user from a
form? The default message from Access that states "You are about to
delete 5 records..." implies that this is available - somewhere. If
setmessages off there is NO indication at all...

Can this be retrieved for use in the afterdeleteconfirm event
procedure? If not, where at?

I haven't had any luck with the CurrentDb.RecordsAffected property...
Doesn't seem to work with form deletes, only DAO.

Thanks,
Greg




Dr. Know
 
The Delete event fires for each record in the deletion.

Declare a variable in the form's General Declarations section:
Dim mlngDeleteCount As Long

Increment it in Form_Delete:
mlngDeleteCount = mlngDeleteCount + 1

Reset it in Form_AfterDelConfirm:
mlngDeleteCount = 0

You can read the variable in Form_BeforeDelConfirm, or wherever else you are
trying to give this message.

Note that this only works if:
- you use an mdb, not an adp;
- you have not turned of the confirm events.
 

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

Back
Top