Share via

Hyperlink Field Opening Another Form

Anonymous
2015-01-14T16:39:30+00:00

I have a form with a sub-form (Task Table-Sub Form) that contains a hyperlink field (Task Code).  I want the hyperlink field to open another form (Task Table Edit) where the Task Code field on each form is equivalent.  On the Task Table Sub-Form the under the properties of the Task Code field, the On Click setting has an embedded macro with the following settings:

OpenForm

     Form name         :  Task Table Edit

     View                  :  Form

     Filter Name        :

     Where Condition:  =[Task Code]=[Forms]![Task Table Edit]![Task Code]

     Data Mode        :

     Window             :  Normal

When the hyperlink field is clicked on the form the linked form opens, but is blank.  I have used the following code in the Where condition field on other forms and it works, but not on this one.      

="[Entry ID]=" & Nz([Task Entry ID],0)

Any advice on the correct code?

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

ScottGem 68,830 Reputation points Volunteer Moderator
2015-01-14T17:47:56+00:00

Why are you using a hyperlink field? You can do this with any text field. If the TaskCode field is on a subform, then your code won't work. You have to use 

Where Condition:  =[Task Code]=[Forms]![Task Table Edit].subformname.Form.[Task Code]

This would be easier with VBA:

DoCmd.OpenForm "Task Table Edit",,,"[Task Code] = " & Me.[Task Code]

Assuming Task Code is numeric.

BTW, its is not good practice to use spaces in Object names.

Was this answer helpful?

0 comments No comments

3 additional answers

Sort by: Most helpful
  1. ScottGem 68,830 Reputation points Volunteer Moderator
    2015-01-14T20:24:58+00:00

    Task Code is a text field.

    Then it would be 

    DoCmd.OpenForm "Task Table Edit",,,"[Task Code] = '" & Me.[Task Code] & "'"

    But using a numeric is better.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2015-01-14T19:01:41+00:00

    I added a numeric code field to the table and used VBA and that worked!  Thanks so much.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2015-01-14T18:18:52+00:00

    Task Code is a text field.

    Was this answer helpful?

    0 comments No comments