|
本帖最后由 todaynew 于 2011-6-29 09:51 编辑
today416 发表于 2011-6-28 21:10
版主能不能帮忙在我的附件中修改下然后再上传给我?
一、主窗体为绑定窗体
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
|
|