Determining SourceObject's Container

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello everyone,

I am really stuck on this and have been hitting a roadblock for hours, and
since I am here, I humbly ask for any suggestions that you folks might have.

I have a form with a subform that is made up of "instances" of yet many more
subform; each instance at the lowest layer comprising of the same form.
These forms are displaying grid data in continuous forms mode.

Right now I have it so that if a user right clicks on a row, I am opening a
small pop so the user can change the status of the row (and subsequentially
the color is changed through conditional formatting code).

I have the popup coming up beside the row in question (with many thanks to
Lebans' excellent examples on his site), but because this lowest subform is
made up of many instances of the same form, I am having a problem telling
which row to change the status for. I was thinking that if I could get the
owner or subform name of the SourceObject that contains the data, I could
then determine which instance it came from an pass the ID along to the
OpenArgs of the popup box.

I can't seem to get the piece of code to give me a subforms container name
that is bound to a particular instance of a form. Is there a way to get this?

I know in C# I could pass the instance along and all would be fine but I am
not sure if this is possible in Access....

Thanks in advance for any advice (I hope it made some sense) and for taking
the time to read this.

Thanks,

Lance
 
I'm not completely sure I understand all of this, but are you looking for
something beyond the subform's Parent property?
 
LTofsrud said:
I have a form with a subform that is made up of "instances" of yet many more
subform; each instance at the lowest layer comprising of the same form.
These forms are displaying grid data in continuous forms mode.

Right now I have it so that if a user right clicks on a row, I am opening a
small pop so the user can change the status of the row (and subsequentially
the color is changed through conditional formatting code).

I have the popup coming up beside the row in question (with many thanks to
Lebans' excellent examples on his site), but because this lowest subform is
made up of many instances of the same form, I am having a problem telling
which row to change the status for. I was thinking that if I could get the
owner or subform name of the SourceObject that contains the data, I could
then determine which instance it came from an pass the ID along to the
OpenArgs of the popup box.

I can't seem to get the piece of code to give me a subforms container name
that is bound to a particular instance of a form. Is there a way to get this?


In Access a form used as a subform is displayed by (or
contained in) a specific subform control. Whenever you
navigate to a control in a subform, the parent form's
container subform control is the parent form's active
control, which you can retrieve using the form's
ActiveControl property. If the code to open the pop up is
in the lowest level subform, then you would use
Me.Parent.ActiveControl.Name
 
Thanks Marshall. That seemed to do the trick. I can't believe I ran right
over that; staring... at... monitor... too... long.
 
Back
Top