INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

form & subform hyperlink to open form with value of hyperlink field

form & subform hyperlink to open form with value of hyperlink field

(OP)
Hi,
I have a form and a subform. When the form opens it displays all Item Numbers that are for a particular project which is determined when the form opens. That all works correctly. I then have a hyperlink on the Item Numbers and want to open a detailed form for that particular Item number. For some reason it is opening the detailed form for the 1st Item Number for that project.

This is my code for the click event for the Item Number:
Private Sub Item_Nbr_Click()
Debug.Print "Item nbr = "; Me.Item_Nbr
hold_Item_Nbr = Me.Item_Nbr
DoCmd.Close acForm, Me.Name, acSaveNo
DoCmd.OpenForm "form_Initiative_Item_Detail", , , "Item_Nbr = " & hold_Item_Nbr, acFormEdit
End Sub

On the Debug.Print value it shows the 1st Item number on the previous form and not the one I clicked.

Would someone know why the Me.Item_Nbr not be the value of the Item_Nbr clicked but be the 1st one listed in the list?

Thanks for any assistance!

RE: form & subform hyperlink to open form with value of hyperlink field

Would it help if you would hold on to the item number you clicked on?
something like:

CODE

Option Explicit
Dim intMyItemNo As Integer
...
Private Sub hyperlink_field_Click()
intMyItemNo = hyperlink_field_value
End Sub

Private Sub Item_Nbr_Click()
 Debug.Print "Item nbr = " & intMyItemNo
 hold_Item_Nbr = intMyItemNo
 DoCmd.Close acForm, Me.Name, acSaveNo
 DoCmd.OpenForm "form_Initiative_Item_Detail", , , "Item_Nbr = " & intMyItemNo, acFormEdit
 End Sub 

Have fun.

---- Andy

There is a great need for a sarcasm font.

RE: form & subform hyperlink to open form with value of hyperlink field

(OP)
Thanks for responding Andy,
I guess I am confused of what field the hyperlink_field_Click() is because the field that contains the hyperlink is what is being performed in Item_Nbr_Click().
Thanks!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close