Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Method 'Parent' of object failed

Tags:

vba

ms-access

I have MS Access 2013 and I'm trying to make a search form that populates other details when a row inside a subform is selected. I figured out how to get which row is selected, and which column, but now I need to pass that information to the parent form so I can populate the other things on the form.

So on my form's subform, I made an On Click event:

Option Compare Database

Private Sub Form_Click()
     MsgBox(Me.Name) ' returns P_pat subform
     MsgBox(Me.Parent.Name) ' says 'Parent' failed

But it can never find its parent. I also tried on a few other events but the results were the same. The Access form looks like this:

enter image description here

The highlighted subform is the one I'm trying to work with, and I want it to call the parent so that the parent can populate its other child subform (the one below the highlighted form).

I feel like I slammed into a brick wall that shouldn't be there and my pride hurts.

How do I get the parent?

I know that I can simply set the record ID I selected with a global variable, but I have no way of triggering an update event for the other subform.

Any help or advice?

like image 905
rlb.usa Avatar asked Jan 23 '26 22:01

rlb.usa


1 Answers

There doesn't look like there is anything at all wrong with your code. So from research there seem to be three possible solutions that I have found so far:

  1. Make sure there are no special characters in your forms' names
  2. Compact and repair
  3. Create a new blank project and import all of your database into the blank project
like image 125
Newd Avatar answered Jan 26 '26 14:01

Newd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!