Microsoft
Software
Hardware
Network
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({Parame
ter})
You wouldn't need to write a Click_Event routine, you just need to assign the function to the event
me.LabelName.OnClick = "=OneCommonFunction({Param
eter})"
Random Solutions
prevent taskkill and netstop command
HTTPS forms loading slow or not loading at all. Using IE6, IE7 and firefox.
access 2003 report with calculated field.
SQL Replication - Requires the actual server name error
Microsoft Excel and PowerPoint 2003 print with no left margin
MSSQLSERVER unhandled exception 80000003, Error: 17311, Severity: 16, State: 1, SQL 2005, Windows 2008
How do I return a datatable from a stored procedure?
Windows Server 2008 r2
Cannot open .xls file attachments in Outlook
Problems with new installation of XP on an older PC.