1、代码写到datacolchangd事件才对;
2、代码要这样写
If forms("窗口1").opened then Dim sl As WinForm.TextBox = Forms("窗口1").Controls("数量") sl.Text = Tables("入库单父表.入库单子表").Compute("sum(数量)")End If