Prev | Current Page 2136 | Next

Michael R. Groh, Joseph C. Stockman, Gavin Powell, and Cary N. Prague

"Access 2007 Bible"

Three new macro actions??”
SetTempVar, RemoveTempVar, and RemoveAllTempVars??”let you create and use temporary
variables in your macros. You can use these variables in conditional expressions to control which
actions execute, or to pass data to and from forms or reports. You can even access these variables in
VBA to communicate data to and from modules.
TIP
CROSS-REF
1146
Professional Database Development Part IV
Enhanced Hello World macro
A simple way to demonstrate how to use variables in macros is to enhance the Hello World example
created earlier in this chapter. Table 36-4 shows the macro actions and action arguments for
mcrHelloWorldEnhanced (shown in Figure 36-11).
TABLE 36-4
mcrHelloWorldEnhanced
Action Action Argument Action Argument Setting
SetTempVar Name MyName
Expression InputBox(???Enter your name.???)
MsgBox Message =???Hello ??? & [TempVars]![MyName] & ???.???
Beep Yes
Type Information
Title Using Variables
RemoveTempVar Name MyName
FIGURE 36-11
mcrHelloWorldEnhanced uses the SetTempVar action to get a value from the user and display it in a
message box.


Pages:
2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148
pozycjonowanie stron Chorzów księgarnia wysyłkowa Okulary przeciwsłoneczne i sportowe szkoła tańca gdańsk ławki betonowe