none
Set an html color as a global variable in Access App 365 RRS feed

  • Question

  • Hi,

    I would like to store an html color (ex #E7F8E0) into a global variable, in order to reuse it in multiple setproperty/color actions.

    unfortunately this type of data is not accepted in SetVariable

    any workaround?

    Sunday, February 5, 2017 6:09 AM

All replies

  • I would like to store an html color (ex #E7F8E0) into a global variable, in order to reuse it in multiple setproperty/color actions.

    unfortunately this type of data is not accepted in SetVariable

    any workaround?

    Hi Gil,

    You could try to store it as Long type:   MyColor = CLng("#E7F8E0")

    Imb.

    Sunday, February 5, 2017 10:58 AM
  • Why not use TempVars

    To set the value you'd do something like:

    TempVars.Add "HTMLColor", "#E7F8E0"

    and then to retrieve it you'd simply do:

    TempVars!HTMLColor


    Daniel Pineault, 2010-2016 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net


    Sunday, February 5, 2017 12:15 PM
  • Hi Gil365,

    >> unfortunately this type of data is not accepted in SetVariable

    Do you mean you are developing with Access web app? Could you share us how you use SetVariable and what error did you get? I made a test with below, it works correctly.

    You could access “=[ColorValue]” in other list views. But, for SetProperty, the value would be reset after you refresh the page.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, February 6, 2017 8:00 AM
  • Thanks Edward, you exactly got my point

    unfortunately when I do the SetProperty as you show, I save the form, come back in the macro, and the Value has been automatically changed from [ColorValue] to #000000

    Thursday, February 9, 2017 7:00 AM
  • Hi Gil365,

    Have you added "=" before [ColorValue]? If not, it will change to #000000. I suggest you check whether you enter "=[ColorValue]" for the Value.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, February 9, 2017 8:06 AM