开发者

Access 2010 Web Database - Update textbox value from local variable?

开发者 https://www.devze.com 2023-02-16 18:51 出处:网络
How do I change a textbox value to the one I have in a local variable? I have expression builder and macros - but not the VBA macros as there seems to be no way of having VBA macros on access开发者_J

How do I change a textbox value to the one I have in a local variable?

I have expression builder and macros - but not the VBA macros as there seems to be no way of having VBA macros on access开发者_JS百科 web forms.


You can use a macro to set the value of a control on a web form to a local variable. Here is a basic example (Access 2010 macros are written in XML). There are two code blocks - one that sets the local variable, and one that sets the value of the text box.

<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<UserInterfaceMacros xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application">
    <UserInterfaceMacro For="cmdSetTxt2LocVar" Event="OnClick">
        <Statements>
            <Action Name="SetLocalVar">
                <Argument Name="Name">LocVar</Argument>
                <Argument Name="Expression">'foo'</Argument>
            </Action>
        </Statements>
    </UserInterfaceMacro>
</UserInterfaceMacros>

And:

<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<UserInterfaceMacros xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application">
    <UserInterfaceMacro For="cmdSetTxt2LocVar" Event="OnClick">
        <Statements>
            <Action Name="SetProperty">
                <Argument Name="ControlName">test</Argument>
                <Argument Name="Property">Value</Argument>
                <Argument Name="Value">LocVar</Argument>
            </Action>
        </Statements>
    </UserInterfaceMacro>
</UserInterfaceMacros>

For a basic overview of UI macros, watch this video: http://office.microsoft.com/en-us/access-help/video-create-a-user-interface-ui-macro-VA101814109.aspx

For more information about SetProperty, see http://msdn.microsoft.com/en-us/library/ff194340.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号