Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Location
    Nottingham, Nottinghamshire, England
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    referencing an unknown form (Access 97 sr2)

    A colleague has just phoned asking for the name of property
    He thinks it's something like currentContextObject...
    I've seen code he's written with it before but neither of us can remember it exactly basically instead of
    forms("myFormName").caption
    you'd type
    currentContextObject.caption
    and it would return the caption of what ever form was open.
    Anyone any idea what the proper name is?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: referencing an unknown form (Access 97 sr2)

    1) CodeContextObject returns the object that is running the current VBA code.
    2) Screen.ActiveForm and Screen.ActiveReport return the form or report object that currently has the focus.

    In many cases, 1 and 2 will be equivalent, but code can run in a form or report that doesn't have the focus; if such is the case, 1 and 2 will return different objects.

  3. #3
    Star Lounger
    Join Date
    Apr 2002
    Location
    Nottingham, Nottinghamshire, England
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: referencing an unknown form (Access 97 sr2)

    Hans you're a star as always

    Thanks

Posting Permissions

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