Vba 当窗体进入编辑模式时,在窗体上显示消息标签
我有一个表单,允许数据输入,上面有一个编辑按钮 当按下编辑按钮时,表单将进入编辑模式,但我希望表单上有一个标签或类似标签,显示“编辑模式”Vba 当窗体进入编辑模式时,在窗体上显示消息标签,vba,ms-access,Vba,Ms Access,我有一个表单,允许数据输入,上面有一个编辑按钮 当按下编辑按钮时,表单将进入编辑模式,但我希望表单上有一个标签或类似标签,显示“编辑模式” 我是访问事件和VBA等的新手,因此非常感谢您的帮助。以下是我发现的代码,适用于我想做的事情。标签中还有一些小字体和前景色代码 在该公司,我还创建了一个标签,以便确定从组合框中更新的值 在AfterUpdate事件的实际组合框本身上创建此代码 Private Sub ActivityCriteria_AfterUpdate() 'Create a label
我是访问事件和VBA等的新手,因此非常感谢您的帮助。以下是我发现的代码,适用于我想做的事情。标签中还有一些小字体和前景色代码 在该公司,我还创建了一个标签,以便确定从组合框中更新的值 在AfterUpdate事件的实际组合框本身上创建此代码
Private Sub ActivityCriteria_AfterUpdate()
'Create a label and show in the label what is being selected on the label caption
AcMessage.ForeColor = vbRed
'vbCrLf equals line break
AcMessage.Caption = "Value passed: " & vbCrLf & ActivityCriteria.Text
AcMessage.FontWeight = Heavy
'Run If statement to determine the value of the combo list
If Me.ActivityCriteria.Text() = "IA - Individual Assist" Then
'Provide the options if the statement is true
AcMessage.ForeColor = vbBlue
AcMessage.FontWeight = Heavy
Me.IndividualName.Visible = True
Me.MemberOrgName.Visible = False
Me.ExtOrganisationName.Visible = False
'Ask the ElseIf statement to determine next value from the combo list
ElseIf Me.ActivityCriteria.Text() = "MA - Members Assisted" Then
'Provide the options if the statement is true
AcMessage.ForeColor = vbMagenta
AcMessage.FontWeight = Heavy
Me.IndividualName.Visible = False
Me.MemberOrgName.Visible = True
Me.ExtOrganisationName.Visible = False
'Another ElseIf statement to determine next value from the combo list
ElseIf Me.ActivityCriteria.Text() = "CA - Community Assisted" Then
'Provide the options for this statement if true
AcMessage.ForeColor = RGB(255, 128, 0)
AcMessage.FontWeight = Heavy
Me.IndividualName.Visible = False
Me.MemberOrgName.Visible = False
Me.ExtOrganisationName.Visible = True
'Otherwise in all other cases
Else
'Do this option
AcMessage.ForeColor = RGB(138, 43, 266)
AcMessage.FontWeight = Heavy
Me.IndividualName.Visible = False
Me.MemberOrgName.Visible = False
Me.ExtOrganisationName.Visible = False
End If
End Sub
在这方面花了几天时间之后,它似乎工作得很好,我希望它能帮助其他人,或者至少让他们知道什么是可能的。下面是我发现的代码,它为我想做的事情工作。