|
Question : CreateEventProc error 57017 Event Handler Invalid
|
|
Hi guys!
I have 96 labels on a form, naming convention is lblDayHr-X-Y where X can be 1-7 and y can be 0-23.
I have the following module that im trying to run in order to programatically add event procedures to these labels:
Dim frm As Form, ctl As Control, mdl As Module Dim lngReturn As Long
On Error GoTo Error_ClickEventProc
Set frm = Forms!sfrmSchedTimes Set mdl = frm.Module For X = 1 To 7 For Y = 0 To 23 strControlName = "lblDayHr-" & X & "-" & Y 'MsgBox strControlName lngReturn = mdl.CreateEventProc("Click", strControlName) mdl.InsertLines lngReturn + 1, vbTab & WGClickProc Next Y Next X ClickEventProc = True
Exit_ClickEventProc: Exit Function
Error_ClickEventProc: MsgBox Err & " :" & Err.Description ClickEventProc = False Resume Exit_ClickEventProc End Function
the form exists, and is named correctly. the form is opened in design view. the msgbox confirms that the name of the control is correct. the first control named lblDayHr-1-0 is valid on the form.
The function fails with the error in the topic. I can't see the rpoblem.
help appreciated...
John
|
|
Answer : CreateEventProc error 57017 Event Handler Invalid
|
|
Write One All inclusive funtion that uses a parameter drawn from the tag property of the label
This function can be called from an event trigger of the label like:
=OneCommonFunction({Parameter})
You wouldn't need to write a Click_Event routine, you just need to assign the function to the event
me.LabelName.OnClick = "=OneCommonFunction({Parameter})"
|
|
|
|