Showing hyperlinks to open other forms after a query.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a form that displays multiple records (form A). I also have a form
that displays the record with all its fields in a single view (form B)
providing more detail.

Is there a way to have form A display a hyperlink in each of the records so
that if a user clicks on it form B opens and he/she can see all the details
of the chosen record?

Thanks,

Trauton
 
Bob,

Wow that sounds great. I'll try it!

Thank you very much!

Trauton

Bob Miller said:
You don't need a hyperlink. Place this in the OnClick of the control
(could be one of the fields (ReqNo in the example) of the record):
Private Sub ReqNo_Click()
On Error GoTo Err_ReqNo_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "forms B"

stLinkCriteria = "[ReqNo]=" & Me![ReqNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_ReqNo_Click:
Exit Sub

Err_ReqNo_Click:
MsgBox Err.Description
Resume Exit_ReqNo_Click

End Sub
Trauton said:
Hi,
I have a form that displays multiple records (form A). I also have a
form
that displays the record with all its fields in a single view (form B)
providing more detail.

Is there a way to have form A display a hyperlink in each of the
records so
that if a user clicks on it form B opens and he/she can see all the
details
of the chosen record?

Thanks,

Trauton
 
Hi Bob,

I am now trying to implement the code you suggested. I am hitting a couple
of snags that I am sure are simple to fix -I just don't now how ;-)

The Data Record Source for Form A is based on a query H that filters the
records shown. I added the code to the ReqNo control to form A (in your
example) and made it open form B. The Data Record Source for Form B is also
based on query H.

When I click on the control and it tries to open form B, I get a message
that says: "Enter Parameter Value" and shows me an input field. If I did
this right what should have happened is that form B would have opened showing
the record for the ReqNo control that I clicked on. As a test, I modified
form B to have nothing under Data Record Control Source. When I clicked on
the ReqNo in form A, form B opened but all the fields showed: Name?. This
tells me that the OnClick code in the form A control is working but some how
I am missing something to get it to open the right record.

Do you know how can I fix this? Thanks!!

Trauton

Bob Miller said:
You don't need a hyperlink. Place this in the OnClick of the control
(could be one of the fields (ReqNo in the example) of the record):
Private Sub ReqNo_Click()
On Error GoTo Err_ReqNo_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "forms B"

stLinkCriteria = "[ReqNo]=" & Me![ReqNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_ReqNo_Click:
Exit Sub

Err_ReqNo_Click:
MsgBox Err.Description
Resume Exit_ReqNo_Click

End Sub
Trauton said:
Hi,
I have a form that displays multiple records (form A). I also have a
form
that displays the record with all its fields in a single view (form B)
providing more detail.

Is there a way to have form A display a hyperlink in each of the
records so
that if a user clicks on it form B opens and he/she can see all the
details
of the chosen record?

Thanks,

Trauton
 
Back
Top