Use macros to automate tasks in Web objects in applications published to Access Services (SharePoint Server 2010)

 

Applies to: SharePoint Server 2010 Enterprise

Macros play a much larger role in Microsoft Access 2010 than in previous versions of Access. In fact, using a macro is the only way to automate tasks in Web objects and in applications that you publish to Access Services in Microsoft SharePoint Server 2010. One area that has caused confusion is using the correct syntax in a macro.

Macro syntax and arguments

There are two classes of macro arguments: string arguments and expression arguments. Each of these classes requires very different syntax.

String arguments

The first class of macro argument is a string argument. You can easily identify string arguments because they do not have an equal sign (=) before and outside the argument text box. An example is the Message argument of the Message Box macro action. To specify a message, enter a string in the argument, without quotation marks. However, you can also enter an expression in this argument by entering an equal sign (=), and then entering an expression. As in all expressions, strings need to be in quotation marks.

Expression arguments

The other class of argument is stated in the form of an expression. An example of this type is the WhereCondition argument of the SetFilter macro action. In the Macro Designer, these arguments display an equal sign (=) before and outside the argument text box. This highlights to the user that the argument must be expressed in the form of an expression.

"Double expression" or "double evaluation" occurs when one expression is nested inside another. In an expression argument, if you enter an equal sign (=) in the text box, the expression will be evaluated two times: the first time for your equal sign and a second time for the equal sign that appears before and outside the argument text box.

Warning

If you are using an expression argument in a Web database macro, the syntax must be correct or you will get a run-time error every time that your macro is run. Double expression is not supported in Access Services applications.