不错不错,谢谢分享,不过代码还可做得更通用些
以下是引用tmtony在2006-6-2 23:51:00的发言:
可在窗体加载的时候加上如下代码:
Dim ctr As Control
For Each ctr In Me.Controls
If Right(ctr.Name, 2) = "标签" Then
ctr.OnClick = "=orderme('" & Left(ctr.Name, Len(ctr.Name) - 3) & "')"
End If
If (ctr.ControlType = acTextBox) Then
If (Nz(ctr.ControlSource) <> "") Then ctr.OnDblClick = "=filterme('" & ctr.Name & "')"
End If
Next
End Sub
这样,后面设置标签和文本框的单击和双击函数就可取消了,而且新增文本框字段和新增标签时不需再修改代码了[attach]18234[/attach]
可在窗体加载的时候加上如下代码:
Dim ctr As ControlFor Each ctr In Me.Controls If Right(ctr.Name, 2) = "标签" Then ctr.OnClick = "=orderme('" & Left(ctr.Name, Len(ctr.Name) - 3) & "')" E ...
tmtony 发表于 2006-6-3 07:51
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) | Powered by Discuz! X3.3 |