Results 1 to 7 of 7
  1. #1
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Dear Loungers,

    Is it possible to use an IIF statement in the LinkMasterFields? I have failed so far - access translates the iif into some strange code starting with substituting semi-colons for commas. And could I use the TempVars value in the field?

    thank you.............................. liz

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    To use IF and TempVars I think you would have to use VBA code or a Macro to set the value of the LinkMasterFields property.
    But I see from Help that the Open event is the only event that can be used to set the value.
    Regards
    John



  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts
    John has pretty much covered the situation, but I did want to add that you can change the subform linkage on the fly using VBA. We have an application where staff reviews several kinds of web submissions, and either accepts them as is, edits and then accepts them, or rejects them. We use a single main form and display the appropriate subform depending on the type of submission, and it works pretty well, although unless you turn off screen updating, there is a noticeable flash as the subform changes.
    Wendell

  4. #4
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Thank you both, I understand the theory. My one question is this, in the VBA code am I setting the link properties to a value or a field name that is then resolved and, if the latter, how does that worl with tempvars since I couldn't directly use that in the properties field itself?

    liz

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    In code you set the value of LinkMasterFields or LinkchildFields to the name of the field or control that provides the link.
    The name of something is just a string, a piece of text. The value you set it to could come from a variable, or be typed into the code.

    Code:
    me.frmsubform.linkedmasterfields = "childID"
    or

    Code:
    me.frmsubform.linkedmasterfields = TempVars("tv_something")
    (I have never used TempVars, but I am assuming they work just like any other variable.)
    Regards
    John



  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts
    Quote Originally Posted by John Hutchison View Post
    (I have never used TempVars, but I am assuming they work just like any other variable.)
    What is a TempVar?

  7. #7
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Dear John,

    These are global variables that were implemented in Access 2007. They are very useful as they are persistent and can be referred to in macros, queries, reports as well as VBA. You can have up to 255 each uniquely named. Makes the "no coding" db very much more flexible.

    This is the MSDN reference page and here are Juan Soto's notes on them.

    liz

Posting Permissions

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