Private Sub Form_Load()
Dim ctls As Controls
Dim ctl As Control
Set ctls = Me.Controls
For Each ctl In ctls
If ctl.ControlType <> acLabel Then
ctl.OnDblClick = "=fldVal(" & 3 & ")" '双击击显示首3行
'ctl.OnClick = "=fldVal(" & 1 & ")" '单击显示首行
End If
Next ctl
End Sub
Function fldVal(n As Long)
Dim rst As Recordset
Dim i As Long
Dim str As String
Set rst = Me.Form.RecordsetClone
str = ""
rst.MoveFirst
For i = 1 To n
str = str & rst.Fields(Me.ActiveControl.Name).Value & Chr(13) & Chr(10)
rst.MoveNext
Next
MsgBox str
rst.Close
Set rst = Nothing
End Function 作者: 想做NO.1 时间: 2011-2-26 10:42 回复 todaynew 的帖子