Transfer hyperlinked record to textbox on another form

ccondran08

Registered User.
Local time
Tomorrow, 01:01
Joined
Feb 27, 2014
Messages
58
Hi, hoping someone can make my day here and assist. I have a subform table that has a column called "Project" and lists all the project numbers. I have set up a Hyperlink on the field so that when the project number is selected is will open up a new form and transfer the existing hyperlink record value into an unbound textbox that is used as a "Search" field to search other records on the opening subform. I can get subform to open the new form but am not having any luck in parsing/transferring the hyperlink value to the textbox. My code is ;

Private Sub PROJECT_Click()
If (Form.Dirty) Then
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm "frm_Project_Search", acNormal, "", "", acAdd, acDialog
DoCmd.Requery ""
Else
DoCmd.OpenForm "frm_Project_Search", , , "Project = '" & Me.txt_Search & "'"
End If
End Sub
 
Why do you have it set up as a Hyperlink? What do you have in the Address of the Hyperlink and what's in the Text to Display?

Anyway if your Hyperlink is in a textbox, let's say for example named Project, to get the Text to Display you would use:

Code:
Me.Project.Hyperlink.TextToDisplay

and the Address part
Code:
Me.Project.Hyperlink.Address
Also this
Code:
DoCmd.OpenForm "frm_Project_Search", , , "Project = '" & Me.txt_Search & "'"

has Me.txt_Search in the WHERE argument. If you want to populate a textbox in the frm_Project_Search form with the value in Me.txt_Search then you need to pass it in the OpenArgs argument something like:

Code:
DoCmd.OpenForm "frm_Project_Search", , , , , , Me.txt_Search

and the assign it to the textbox in the form Open Event of the frm_Project_Search form something like:

Code:
Me.NameOfTextBox = Me.OpenArgs
 
Last edited:

Users who are viewing this thread

Back
Top Bottom