RE: Hyperlink to a specific record in another form
- From: amie <amie@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 13 Aug 2007 15:20:01 -0700
Brian-
Thanks. What you are describing seems to be what I want to do, but it went
completely over my head. Could you tell me, or refer me to somewhere I can
figure out how to do this step by step? I just taught myself the basics of
access over the past few weeks, so virtually all of the writing codes stuff
is way over my head.
Thanks so much.
--
Amie
"Klatuu" wrote:
Bookmarks are not presisent and in any case, would not transfer from one form.
to another.
Hyperlinks do not apply in this situation. Hyperlinks take you to a
specific document or file, not to a record in a table.
The most common way to open a form to a specific record from another form is
to use either the Where argument or the OpenArgs argument of the OpenForm
method. My preference is the OpenArgs argument.
Assume FormA opens FormB and you want FormB to open to a customer selected
in FormA.
In FormA:
Docmd.OpenForm "FormB", , , , , , Me.txtCustID
In the Load Event of FormB:
If Not IsNull(Me.OpenArgs) Then
With Me.RecordsetClone
.FindFirst "[CustID] = " & Me.OpenArgs
If .NoMatch Then
Msg Box "Customer " & Me. OpenArgs & " Not Found"
Else
Me.Bookmark = .BookMark
End If
End With
End If
--
Dave Hargis, Microsoft Access MVP
"Brian" wrote:
Not sure how this would apply to a hyperlink, but you can use the Bookmark
property to identify & bring up a particular record.
Me.RecordsetClone.FindFirst "[CustomerID] = " & <CustomerIDOfDesiredRecord>
Me.Bookmark = Me.RecordsetClone.Bookmark
I use this to navigate to a specific record selected in a combo box on the
form itself, thus the "Me" refers to the same form. It finds the first record
matching the desired CustomerID (FindFirst), then goes to that record
(Me.Bookmark = ...).
You would just have to pass the desired value from your hyperlink to the
form that is to be opened (perhaps as a public variable) and put the above
code in the form's open event.
Optionally, you could filter the form as it is opened to just the record you
want by referring to the value of the hyperlink in the criteria line of the
form's RecordSource query.
"amie" wrote:
I am trying to create a hyperlink that will open up a specific record in
another form instead of always opening to the first record. Does anyone know
how to do that? Thanks
--
Amie
- Follow-Ups:
- RE: Hyperlink to a specific record in another form
- From: Klatuu
- RE: Hyperlink to a specific record in another form
- References:
- RE: Hyperlink to a specific record in another form
- From: Klatuu
- RE: Hyperlink to a specific record in another form
- Prev by Date: How do I set up a Startup Form with Access 2007 ?
- Next by Date: Access 2007 forms and filters
- Previous by thread: RE: Hyperlink to a specific record in another form
- Next by thread: RE: Hyperlink to a specific record in another form
- Index(es):
Relevant Pages
|
Loading