Access 2013 VBA - Setting New Click Event for Controls -
I searched everywhere for this, and it looks like a simple improvement, but I do not seem to find a solution Happen. I have many rectangles controls in my Access 2013 form, and I'm creating an OnClick event that manages them all. I've worked on a few different ways, and I think I found the simplest / clear way to do this. I put control in one collection and I change the OnClick event for each control. Here's my problem: Opens the access form and acknowledges that I have changed the event for control, but once I click on the control, it throws an error and will not execute this event.
Error:
"event property setting has generated the following error recorded went expression as the name of a function in the went expressions recorded by the Microsoft Can not get access. "
code:
Collection dim CTL as Access.CONTROL set m_colRectangle = new archive for each CTL in Me.Controls Private Sub Form_Load () dim m_colRectangle so ctl.ControlType = acRectangle then CTL .Name = "shpTest" then m_colRectangle.Add CTL, ctl.Name ctl.OnClick = "= TestClick ()" '& lt; --- finished error on this line end next CTL End Sub Private Sub TestClick () MsgBox "Test" End Sub
Alternatively, I have a simple shpTest.OnClick = "= TestClick ()"
In the Form_Load e Vent, and does it have any idea that someone produced the same error?
The error message is telling you that access to function TestClick Your TestClick is a sub-method, not a function.
Here is a simple example, which has been tested in Access 2010 and 2013, which shows that the my access 2013 trial was a traditional desktop application Note If you access in 2013 Working with webpacks, I do not know what will happen. of any control. OnClick can use a function for the property ... but you function . : -)
Private Sub Form_Load () Set control as dim CTL CTL = ctl.OnClick Me.Controls ( "txtMathExpresson") = " = TestClick () "set CTL = nothing end sub Private function TestClick () MsgBox" test "end function
Comments
Post a Comment