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
精彩评论