Eleyna
Eleyna

Reputation: 99

Referencing the value of a hyperlinked text box

So I'm having some difficulties with this code. I know it's obnoxiously wordy, but every attempt I made to turn some of these form references into variables to save space ended with me having even less functionality than before.

Basically what I've done so far is create a navigation form with several tabs, one to create a ticket, one to resolve/edit a ticket, and one to search the tickets. The search tab is basically a continuous form that updates based on the search criteria I enter. My goal is that when I click on the ticketID for each record, it will take me to the selected record on the Resolve/Edit Ticket page (on that page I have a combo box [called cboGoToRecord] where you can select the record you want).

I have a hyperlink in place that takes the user to the Resolve/Edit page and code that works ONLY when the line I've denoted with four asterisks (for clarity) is replaced with

rst.FindFirst "ticketID =" & [some number].

When I do that, the results are as expected. If I leave it as it is below, every record looks up the first record (A Debug.print check shows that the value of this field is apparently always 1...) So I guess what I need to figure out is how do I access the ticketID hyperlink's value so that I can put it on that line and make my code function effectively? I apologize if this is overly detailed but figured too much was better than not enough.

 Private Sub ticketID_Click()

    'Takes user from Search Tickets to Resolve/Edit Issues tab
    DoCmd.BrowseTo acBrowseToForm, "frmResolveIssues", "frmBrowseTickets.NavigationSubform"

    On Error Resume Next
    Dim rst As Object
    Set rst = Forms!frmBrowseTickets!NavigationSubform.Form.RecordsetClone
    [Forms]![frmBrowseTickets]![NavigationSubform].Form![cboGoToRecord].Value = [Forms]![frmBrowseTickets]![NavigationSubform].Form![ticketID].Value
****rst.FindFirst "ticketID =" & [Forms]![frmBrowseTickets]![NavigationSubform].Form![cboGoToRecord].Value
    Forms!frmBrowseTickets!NavigationSubform.Form.Bookmark = rst.Bookmark

    Debug.Print [Forms]![frmBrowseTickets]![NavigationSubform].Form![ticketID].Value

End Sub

Edit: After altering my form to add a separate hyperlink and referencing the static ticketID, I have concluded that everything I thought was true was not. Finding the value of a hyperlink was NOT the problem. The problem is that my ticketID value truly does insist on being one, and I have no clue how to fix that.

Upvotes: 0

Views: 36

Answers (1)

Gustav
Gustav

Reputation: 55841

When this works:

Debug.Print [Forms]![frmBrowseTickets]![NavigationSubform].Form![ticketID].Value

then also check out:

 Debug.Print [Forms]![frmBrowseTickets]![NavigationSubform].Form![cboGoToRecord].Value

As June7, I never use the Navigation form. It complicates everything too much.

Upvotes: 1

Related Questions