access 批量设置控件事件

Private Sub Form_Load()
    Me.Move -3000, -2500, Me.Width, 15000
    For Each temp In Me.Controls
        If TypeOf temp Is TextBox Then
            temp.OnChange = "=FilterTable()"
        ElseIf TypeOf temp Is ComboBox Then
            temp.AfterUpdate = "=FilterTable()"
        End If
    Next
End Sub


Function FilterTable()
    MsgBox 1
End Function

 在上面的事件绑定中,注意onchange事件和AfterUpdate事件,前者有on,后者没有on

posted @ 2023-07-13 20:10  一曲轻扬  阅读(60)  评论(0)    收藏  举报