Trying to populate vale of a field in a sub-form with the value of a field on a forms sub-form

I have a hyperlink field in a sub-form or a main form.  When the user clicks the hyper link I have a 3rd form opening and want a field on that 3rd form to populate with the value of the clicked hyperlink.

Here is my code that opens the 3rd form which works fine...

Private Sub txtID_Click()

    If DCount("*", "tblPlayerNotes", "PlayerId=" & Me.txtPlayerID) > 0 Then
        DoCmd.OpenForm "subfrmPlayerNotes", acNormal, , "[PlayerID]=" & Me.txtID, , acWindowNormal
        DoCmd.OpenForm "subfrmPlayerNotes", acNormal, , , acFormAdd, acWindowNormal
    End If

End Sub

Open in new window

And here is my default value syntax for the field on the 3rd form which isn't working.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You must refer to the Subform differently:


Note too that a Default Value is only set for New Records.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hamed NasrRetired IT ProfessionalCommented:
One way:
      Use the OpenArgs parameter in the OpenForm command.

     DoCmd.OpenForm "subfrmPlayerNotes", acNormal, , , acFormAdd, acWindowNormal, txtID.Value

    In Open event of form3

    txtID = Me.OpenArgs

Onother way:
    Declare a global variable gTemp in a module as Variant

    Private Sub txtID_Click()
        gTemp = txtID.value
   End Sub

    And in Form3 Open event
        txtID = gTemp
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
So I'm curious - which way did you end up doing this?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

SteveL13Author Commented:
Your way.  I am still trying to find out how to refer to forms and their subforms and other subforms.  I stumble over that every time.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Just remember that a Subform is ALWAYS in a Subform Control - so just like every other Control on a Form, you must first refer to the Control, and you can then refer to other properties/methods/attributes of that control.
SteveL13Author Commented:
Thank you for the valuable information.  I do appreciate it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.