Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Mar 2002
    Location
    St Albans, Hertfordshire, England
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Recalling Global Variables (A2k/Win2k)

    <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15> It's one of those days when I can't work out the answer to a simple question! <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

    I have a global variable 'gbl_Entity_Description_Null_Descriptions' which is updated from a table at system startup

    On a form, I would like to be able to display the value of the variable - how do I go about it, without using the table?

    i.e. textbox control data source set as '=gbl_Entity_Description_Null_Descriptions', but this obviously does not work!!

    Thanks

  2. #2
    Lounger
    Join Date
    Mar 2002
    Location
    St Albans, Hertfordshire, England
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Recalling Global Variables (A2k/Win2k)

    Okay - I've got it now - I just added a line to the on_Load event of the form:

    me!threshold = cdec(gbl_Entity_Description_Null_Descriptions)

    Works perfectly (cded is used as the variable is stored as a variant, and I need to ensure it is returned as a decimal value, in order to display the percentage value correctly

    Thanks anyway

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Recalling Global Variables (A2k/Win2k)

    For future reference, you can't reference variables directly like that as controlsources, nor can you use them in queries. Wrapping them in a function as you did is one method to make them available. Another is to create a function that returns the value of the variable. Then you can use that function in a query or as a control source and it will return the variable value.
    Charlotte

Posting Permissions

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