Delete records on two forms at once

CanWest

Registered User.
Local time
Today, 14:15
Joined
Sep 15, 2006
Messages
272
I need to delete the current records on two different forms. I need to be able to do that from only one of the forms because the second is hidden. I am drawing a blank
 
What's the idea behind running two forms in the first place? Are the record sources related via a key?
 
What's the idea behind running two forms in the first place? Are the record sources related via a key?

They are not related, however they do need to be deleted at the same time as it affects a number of reports. I am working with an existing db that was created by someone else and have to work within those parameters.
 
I would guess that you will need two delete queries, one keyed to each of the forms, using;
Code:
Forms!FormName!ControlName
in the criteria, to select the current record in each of your forms.
 
For each delete routine, here are the steps I would follow:
Code:
Forms("FormName").SetFocus
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
Forms("FormName").Requery
Then set focus back to the form you're running the code from.
 
I would guess that you will need two delete queries, one keyed to each of the forms, using;
Code:
Forms!FormName!ControlName
in the criteria, to select the current record in each of your forms.

Thankyou

That worked perfectly
 

Users who are viewing this thread

Back
Top Bottom