Results 1 to 15 of 15
  1. #1
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1

    Unanswered: Link to record from a subform

    Merry Xmas obviously!
    I have a main form based on the HOSTS table which contains basic server info. I have a subform based on the INSTANCES table linked by NODENAME. I have embeded the subform in the main form and it runs beautifully. For each node, I click to on the main form, the subform displays the instances.

    I want to make the INSTANCE field, in the subform a hyperlink, taking me to the instance information form for that record, when clicked.

    In designer, I select the field in the Instances_Subform and assign it an Open Form macro based on the criteria [Instance]=[Forms]![Instances_Subform]![Instance].

    but when I click if from within the main form I get a Parameter error asking for the instance name, which if I manually type in, takes me to the right instance record.

    .... If I run the Instances_Subform on its own, the Instance Field link, DOES take me to the right record without Parameter error. Its only when it is embedded that it doesn't work.
    .....If I try this with another version of the Instances_Subform open ... it partially works in that it takes me to the first record in the INSTANCES table, not the one I clicked on.

    Any thoughts on this?
    Last edited by Raddle; 12-24-10 at 08:57.

  2. #2
    Join Date
    Mar 2007
    Posts
    277
    RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP, ac07, ac10 - WinXP Pro, Win7 Pro
    Please reply to this forum so all may learn.

  3. #3
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1

    A happy Xmas After all

    Wow ... that was quick. AND effective

    Thank you soooo much.

    Have a good one!

  4. #4
    Join Date
    Mar 2007
    Posts
    277
    Glad we could help. Merry Christmas.
    RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP, ac07, ac10 - WinXP Pro, Win7 Pro
    Please reply to this forum so all may learn.

  5. #5
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1
    Hmm may have spoken juuuust to quickly there.

    I am now getting the same error except that is has a longer context string (no idea what the correct term is for this -sorry)

    So now I get the same parameter error type but for the longer path, as noted from your helpful guide.

    Enter Parameter Value - Forms!Single_Host_Info!Instances_Subform!Instance.

    I was sure that this worked the first couple of times. At best this is looking like a flakey way to do this. Am I going this best practice?

    I just want to hyperlink to a record from a subform.

    Apologies for changing my story here. I really though we had this squared away!
    Last edited by Raddle; 12-24-10 at 10:17.

  6. #6
    Join Date
    Mar 2007
    Posts
    277
    Your SubForm reference should be:
    Forms!Single_Host_Info!Instances_Subform.FORM!Instance
    RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP, ac07, ac10 - WinXP Pro, Win7 Pro
    Please reply to this forum so all may learn.

  7. #7
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1
    Thanks so much for helping.

    I have put that into the Where Condition of the Macro event for that field but still no joy.

    [Instance]=[Forms]![Single_Host_Info]![Instances_Subform.FORM]![Instance]

    Is this what you meant?

    I am not in the VBA screen, I am using the MACRO route. Is that the issue possibly?

  8. #8
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1
    If you do come back then, thanks again.

  9. #9
    Join Date
    Mar 2007
    Posts
    277
    I do not use Macro's so I'm out of my element here. Assuming the [Instance] field is numeric, in code I would set the WhereCondition to:
    "[Instance] = " & Me.Instance
    This is on the SubForm so there is no need to reference through the Forms collection when Me. will do.
    RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP, ac07, ac10 - WinXP Pro, Win7 Pro
    Please reply to this forum so all may learn.

  10. #10
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1
    Instance field is alphanumeric.

    When I set the Where condition to the code you gave me, it errors asking for me.instance, which I guess is the same original problem.

    For some reason, I can't parse the current record to Access to get it to act on that.

    Anyway, thanks so much for looking into this. Will get there at some point and post it back here.

  11. #11
    Join Date
    Mar 2007
    Posts
    277
    If the field is text then the reference needs to be enclosed in single quotes.
    Once again in code it would be:
    DoCmd.OpenForm "YourFormName",,,"[Instance] = '" & Me.Instance & "'"
    RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP, ac07, ac10 - WinXP Pro, Win7 Pro
    Please reply to this forum so all may learn.

  12. #12
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1
    And so to my comment earlier at 08:13 ... hooray!!!

    Thank you oh Rural One ...

    I notice in your code here that there are several commas, where I assume, one could put aruments, for additional things.

    Do you have any further pages to direct me to, where those all important commas and quote marks are explained. I am slowing getting into this and your answer here has shown me it is time to up the ante.

    If not, no worries and thank you again.

    Raddle.

  13. #13
    Join Date
    Mar 2007
    Posts
    277
    What version of Access are you using? VBA Help is where I would look for the actual descriptions of each argument for the command. <ALT>F11 and then F1
    RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP, ac07, ac10 - WinXP Pro, Win7 Pro
    Please reply to this forum so all may learn.

  14. #14
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1
    Access 2010.

    Agreed that is a great starting point. The thing is that I am so poor at this, that I sometimes just get lost in the help itself. I guess the biggest issue, is the syntax. I mean, it might as well be Shakespeare half the time!!

    Anyway, not to worry. Thank you soo so much again.

  15. #15
    Join Date
    Mar 2007
    Posts
    277
    It comes with time and there are a ton of free tutorial sites on the net for Access.
    RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP, ac07, ac10 - WinXP Pro, Win7 Pro
    Please reply to this forum so all may learn.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •