Consulting

Results 1 to 2 of 2

Thread: Solved: Using Macro Defined Variables

  1. #1
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location

    Solved: Using Macro Defined Variables

    I have a macro where I would like to set some temporary variables. I know how to set the variables, but then it doesn't seem to allow me to use these values later on in the macro.

    Any pointers?
    4 variables: mgr, amt, ext, request
    I want all these values set by objects on the subform ie:

    SetTempVar--> Name: mgr, Expression: [Forms]![Subform].[Form]![Combo225]
    SetTempVar--> Name: amt, Expression: [Forms]![Subform].[Form]![Text100]
    SetTempVar--> Name: ext, Expression: [Forms]![Subform].[Form]![Combo210]
    SetTempVar--> Name: request, Expression: [Forms]![Subform].[Form]![Combo115]

    I later want to use that variable in a macro condition where:
    (ReviewYN ="N" AND RequiresReview(mgr, amt, ext, request)) triggers a RunSQL command.

    The condition is too long if I bind the parameters to the Form!item.Value.

    I am doing it the way I described and it seems to think that I haven't passed any parameters into the function.
    Someday I'll understand everything...
    Even then...I'll still pretend I'm a beginner.

  2. #2
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location
    http://blogs.msdn.com/b/clintcovingt...cess-2007.aspx

    There are four new macro actions associated with TempVars:
    (1) TempVars![Name]returns the variant value that was stored.
    (2) SetTempVars(Name, Expression) allows macros to set a TempVar to a given value.
    (3) RemoveTempVars(Name) removes the TempVar from the store.
    (4) RemoveAllTempVars empties the TempVars store.

    My book and Help all mentioned everything but the TempVars![Name] part. This does the trick. Hope this helps someone else.
    Someday I'll understand everything...
    Even then...I'll still pretend I'm a beginner.

Posting Permissions

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