SetTempVar

Discussion in 'Access Macros' started by alhotch, May 11, 2010.

  1. alhotch

    alhotch Guest

    Hiw do I set this variable in a macro using the function from API: Get Login
    name
    http://www.mvps.org/access/api/api0008.htm ?

    This function gets the ComputerName and I want to set a Temp Variable so I
    can refer to it in queries.
     
    alhotch, May 11, 2010
    #1
    1. Advertisements

  2. Alhotch,

    In a macro, just enter the SetTempVar action, in the Name argument enter
    whatever you want the name of the TempVar to me, and in the Expression
    argument, just enter like this:
    fOSUserName()
     
    Steve Schapel, May 12, 2010
    #2
    1. Advertisements

  3. alhotch

    alhotch Guest

    Works as advertised, Steve. I had originally used a "sample" macro that
    demonstrated this capability. I was using:

    ComputerName - Macro Name
    SetTempVar - Action
    MyVar,fOSMachineName - Argument
    [TempVars]![MyVar]<>0 - Condition
    MsgBox - Action
    ="You entered " & [TempVars]![MyVar] & "." - Argument
    RemoveTempVar - Action
    MyVar - Argument

    This three line macro was giving me a "Type Mismatch" error. Removing the
    "<>0" part of the above [TempVars]![MyVar] Condition makes trhis macro work
    correctly.

    Thanks for your help. I was sure I had done it right but not being a VB
    programmer, I was doubting the fOSMachineName function.
     
    alhotch, May 12, 2010
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.