Trying to open form from a hyperlink on a sub-form

I have a form that has a sub-form in datasheet view.  On the sub-form is a text field named txtRecord.  The field is a hyperlink.  When the user clicks it I want a 3rd form to open to a specific record.  \\Here is my onclick code of the hyperlink field but it is not working.   Can someone assist?

        DoCmd.OpenForm "frmLessons", acNormal, , "[ID]='" & Me.txtID & "'", acFormReadOnly, acWindowNormal

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.

Dale FyeOwner, Developing Solutions LLCCommented:
This is because the text in a hyperlink field contains a bunch of html codes in addition to the ID that you are actually see in the field.

That is why most professional developers will encourage you not to use the hyperlink data type, but to use text instead.  There are a number of ways to actually launch the application associated with a hyperlink without actually using a hyperlink data type.
Is it a hyperlink data type?  Hyperlinks are not used this way.  they are not simple ID's as you seem to be expecting.

Is the form opening and you are not finding the record you expect or is the form not opening at all?  "Not working" isn't a helpful statement.  You have to tell us what is happening, including any messages and what you expected to happen although in this case, it is pretty clear what you expected to happen.
SteveL13Author Commented:
The field in the table is a text field.  But on the form I set "Is Hyperlink" to yes.  Nothing happens when I click it.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Rey Obrero (Capricorn1)Commented:
did you use the click event of the control  "txtRecord" ?

private sub txtRecord_click()

DoCmd.OpenForm "frmLessons", acNormal, , "[ID]='" & Me.txtID & "'", acFormReadOnly, acWindowNormal

end sub
Rey Obrero (Capricorn1)Commented:
oh, and another thing about this "Is Hyperlink" set to yes, control
- the focus must not be in the control you are going to click.
Since the field is not actually a hyperlink, the IsHyperlink property should be No.  If you want it to look like a hyperlink, they you would set the DisplayAsHyperlink property to Yes.

But, keep in mind that since you are using the click event to activate the "link", you will NOT be able to edit the field by clicking into it.  Because of this, I always use the dbl-click event to activate my "links".

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
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.