Hi,
I have a simple form that contains a sub-form. I have a button "delete" that will reference a VB sub, which will perform checks and then, if appropriate, delete the relevant record, be it from the main form or the subform.
The "delete" sub needs therefore to know whether focus is in the subform or the main form. How can this be done? I've tried ActiveForm, which returns only the name of the main form, and ActiveControl which, somewhat unhelpfully, only retrieves the name of the VB sub. I could put up with only the field name being returned, as they are unique between the tables, but I can't even do this.
The only way I can think of doing it is having two delete buttons, which is pretty naff.
Please note I've only been doing Access a couple of days, so any advice will need to be fairly simple!
Thanks.
I have a simple form that contains a sub-form. I have a button "delete" that will reference a VB sub, which will perform checks and then, if appropriate, delete the relevant record, be it from the main form or the subform.
The "delete" sub needs therefore to know whether focus is in the subform or the main form. How can this be done? I've tried ActiveForm, which returns only the name of the main form, and ActiveControl which, somewhat unhelpfully, only retrieves the name of the VB sub. I could put up with only the field name being returned, as they are unique between the tables, but I can't even do this.
The only way I can think of doing it is having two delete buttons, which is pretty naff.
Please note I've only been doing Access a couple of days, so any advice will need to be fairly simple!
Thanks.