Vba 控件上的鼠标事件

Vba 控件上的鼠标事件,vba,ms-access,onclick,onmousemove,Vba,Ms Access,Onclick,Onmousemove,在Access 2010中,我构建了一个日历。我现在正在整理它,想知道是否有一种“更干净”的方式来编码一些东西 我有几个函数: Mousey()-->将光标更改为标准手指指针(不包括在标准Access/VBA库中) ClickDay(intClick为整数)-->允许用户进入该天了解更多详细信息 在我的日历上,我有6行,每行7天。每天调用Mousey()函数\u MouseMove和\u Click()上的ClickDay()函数 我现在正在做的是为调用myClickDay函数的所有42个\u

在Access 2010中,我构建了一个日历。我现在正在整理它,想知道是否有一种“更干净”的方式来编码一些东西

我有几个函数:
Mousey()
-->将光标更改为标准手指指针(不包括在标准Access/VBA库中)

ClickDay(intClick为整数)
-->允许用户进入该天了解更多详细信息

在我的日历上,我有6行,每行7天。每天调用
Mousey()
函数
\u MouseMove
\u Click()
上的
ClickDay()
函数

我现在正在做的是为调用my
ClickDay
函数的所有42个
\u Click()
创建一个事件过程,并为调用my
Mousey
函数的
\u MouseMove
创建另42个事件过程

显然,这是84个程序(每个3行),我想精简

有人能想出一种方法,用某种循环将每个函数放在一个过程中吗?以下是我的职能:

Private Function ClickDay(intClick As Integer)
    'Function that is called when one of the number boxes are clicked
    Dim intYear As Integer
    Dim intMonth As Integer
    Dim intDay As Integer

    'Get the pieces of the date based on box that is clicked
    intYear = lblYear.Caption
    intMonth = ChangeToMonth(lblMonth.Caption)
    intDay = Me("t" & intClick).Value
    'change global variable
    gintDate = DateSerial(intYear, intMonth, intDay)
    'go to the date clicked
    DoCmd.OpenForm ("frmToday")
End Function


你可以用一些控制阵列吗?看,这是非常有用的。非常感谢。很高兴这有帮助。如果你愿意,你可以在这里发布你的最终解决方案,并接受它作为一个答案,以便它可以帮助未来的访问者:)由于这个项目的时间限制,我决定不重写代码,只是保留了我所拥有的。如果我再次遇到这样的情况,我一定会回到这篇文章并分享一些代码。
Public Function Mousey()
    Dim hCur As Long

    hCur = LoadCursor(0, IDC_HAND)
    If (hCur > 0) Then
        SetCursor hCur
    End If
End Function