我看到这个程序了,可是复制过来不好使,我的代码如下:
Dim i As Long, j As Long
Dim ctls As Controls, ctl As Control
Set ctls = Me.Child2.Form.Controls
Dim MyTop As Long, MyHeight As Long
MyTop = Me.查询7.Form.SelTop
MyHeight = Me.查询7.Form.SelHeight
Me.Child2.SetFocus
For i = 0 To MyHeight - 1 ' 选定的行数
Me.查询7.Form.SelTop = MyTop + i
If Me.Child2.Form.NewRecord <> True Then
DoCmd.RunCommand acCmdRecordsGoToNew '增加一条记录
End If
For Each ctl In ctls
If ctl.ControlType <> acLabel Then
ctl.Value = Me.查询7.Form.Controls(ctl.name).Value
End If
Next ctl
Me.Child2.Form.Recalc
Next
其中Dim i As Long, j As Long
Dim ctls As Controls, ctl As Control
Set ctls = Me.Child2.Form.Controls
Dim MyTop As Long, MyHeight As Long
MyTop = Me.查询7.Form.SelTop
MyHeight = Me.查询7.Form.SelHeight
Me.Child2.SetFocus
For i = 0 To MyHeight - 1 ' 选定的行数
Me.查询7.Form.SelTop = MyTop + i
If Me.Child2.Form.NewRecord <> True Then
DoCmd.RunCommand acCmdRecordsGoToNew '增加一条记录
End If
For Each ctl In ctls
If ctl.ControlType <> acLabel Then
ctl.Value = Me.查询7.Form.Controls(ctl.name).Value
End If
Next ctl
Me.Child2.Form.Recalc
Next
其中 MyHeight = Me.查询7.Form.SelHeight
SelHeight的值一直是0 为什么。