Delete Record in Subform

Jason1971

Registered User.
Local time
Today, 20:06
Joined
Jan 19, 2009
Messages
46
Hi,
I have a form1 containing a subform(datasheet). I have a delete record button on the form1 which, when clicked, I want to delete the current record in the subform(datasheet). I'm not sure how to go about doing this. I'm not sure of the delete record code required, given it is a delete button on form1 not the subform(datasheet)? Thank you for any help.
 
The problem is when you click on a control on your main form the focus moves away from your subform. So how do you identify (visually) which record on the subform you would like to delete?

Solution: Make your subform a continuous form and add a delete button. The code will automatically be included.
 
what happens if you click in the subform, and then press the delete key?

does that delete it?

did you realise you could do that?
 
The problem is when you click on a control on your main form the focus moves away from your subform. So how do you identify (visually) which record on the subform you would like to delete?

Solution: Make your subform a continuous form and add a delete button. The code will automatically be included.

vbaInet and gemma-the-husky thanks for your comments. The continous form option worked great! (Regarding the focus moving away...the record number remains unchanged in the subform so presumably code could still be used to identify the selected subform record.) Anyway I've fixed my problem using the continous ("multiple Items") form.
Thanks guys.
 
vbaInet and gemma-the-husky thanks for your comments. The continous form option worked great! (Regarding the focus moving away...the record number remains unchanged in the subform so presumably code could still be used to identify the selected subform record.) Anyway I've fixed my problem using the continous ("multiple Items") form.
Thanks guys.

yes

in the main form, the selected item in the subform is still/just

mysubformname!idfieldname
 
You're most welcome. Glad I could make some input.

(Regarding the focus moving away...the record number remains unchanged in the subform so presumably code could still be used to identify the selected subform record.)
Just to clarify my point, I did say "visually", because when you are deleting something it would be nice for you to know which record is being deleted based on it being highlighted or whatever way it's represented.
 

Users who are viewing this thread

Back
Top Bottom