一、主窗体为绑定窗体
1、主窗体主动,子窗体从动,则主窗体的成为当前事件写为:
Private Sub Form_Current()
Dim a As Long
a = Me.Form.CurrentRecord
Me.frmMin_Sub.Form.SelTop = a
End Sub
2、子窗体主动,主窗体从动,则子窗体的成为当前事件写为:
Private Sub Form_Current()
Dim a As Long
a = Me.Form.CurrentRecord
DoCmd.GoToRecord acDataForm, Me.Parent.Form.Name, acGoTo, a
End Sub
二、主窗体为非绑定窗体
1、子窗体主动,主窗体从动,则子窗体的成为当前事件写为:
Private Sub Form_Current()
Dim ctrls As controls
Dim ctrl as control
set ctrls=Me.Parent.Form.controls
for each ctrl in ctrls
if ctrl.controltype=acComboBox or ctrl.controltype=acTextBox then
ctrl.value=me.controls(ctrl.name).value
end if
next
End Sub 作者: pq318 时间: 2011-6-29 16:56
斑竹牛啊,还有这招,我解决的办法用的是刷新,外加在子窗体打开在里面录入临时数据作者: today416 时间: 2011-6-30 18:00
斑竹牛
可是我搞不明白为什么主窗体主动,子窗体从动的情况下,用GOTORECORD方法不行.
用SELTOP确可以.SELTOP不是设置位置的属性么?作者: todaynew 时间: 2011-7-1 08:26