在访问子表单中获取当前选定的记录值

时间:2015-08-28 11:23:56

标签: vba ms-access access-vba

我在Access 2010数据库中有2个子表单;根据subform1字段值的选择,vba程序将运行subform2输出,子表单1和2中的公共文本字段为" supplier_name"。 所以,我尝试了双击""在subform1上写一个事件来编写currentRecord方法,见下文,

<ScrollViewer x:Name="ScrollViewer1">

</ScrollViewer>


<i:Interaction.Triggers>
    <my:ScrollEventTrigger SourceName="ScrollViewer1 
                           VerticalOffset="0">
       <ei:ControlStoryboardAction Storyboard="{StaticResource ScrolledTopAnimation}" ControlStoryboardOption="Play"  />
    </my:ScrollEventTrigger>

    <my:ScrollEventTrigger SourceName="ScrollViewer1 
                           VerticalOffset="0.5" Unit="Relative" ">
       <ei:ControlStoryboardAction Storyboard="{StaticResource ScrolledToMiddleAnimation}" ControlStoryboardOption="Play"  />
    </my:ScrollEventTrigger>

</i:Interaction.Triggers>

我在第二行收到运行时错误3075;查询表达式中的语法错误(缺少运算符)&#39; [Supplier_name] = Me!当前记录![Supplier_name]&#39; 请帮忙

2 个答案:

答案 0 :(得分:0)

在代码第二行的位置后面缺少一个空格:

strSQL = "Select * from [Query1] where "

你的&#34;也存在问题。和&#39;第三行中的字符:

strSQL = strSQL & "[Supplier_name] ='" & Me!current record![Supplier_name] & "'"

答案 1 :(得分:0)

谢谢它对我有用,但没有currentrecord属性

strSQL = strSQL & "[Supplier_name] ='" & Me![Supplier_name] & "'"