• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

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

--Steve
0
SteveL13
Asked:
SteveL13
1 Solution
 
Dale FyeCommented:
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.
0
 
PatHartmanCommented:
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.
0
 
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.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy 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
0
 
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.
0
 
PatHartmanCommented:
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".
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now