Re: CreateEventProc error
- From: "Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx>
- Date: Tue, 21 Feb 2006 18:03:14 -0500
I used an existing form when I tested it.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"dchman" <dchman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7B5C9EC2-DF70-459F-9063-58B41ABEF46B@xxxxxxxxxxxxxxxx
thanks for taking a look at this. I checked the value for strCtlName and
it
is a valid control on the form, so i'm not sure what is going on. I'm
doing
this on an existing form, which I've opened with the acDesign option, so
that
I can create controls, and have tried adding the event procedure both
before
and after saving the form to no avail. The examples I've seen are always
for
new forms. Do think that matters?
--
dchman
"Dirk Goldgar" wrote:
"dchman" <dchman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:91640616-ACF5-4373-B30F-1EEDC3226A11@xxxxxxxxxxxxx
I have an app in which a controls are added to a form dynamically.
After creating the controls I want to code the KeyDown event. Here
is what I have tried;
Private Sub CreateKeyDownEvent(frmCurrent As Form, strCtlName As
String)
On Error GoTo error_CreateKeyDownEvent
Dim lngReturn As Long
Dim mdl As Module
Dim strLine As String
strLine = "Call NudgeCurControl(KeyCode)" & vbCrLf & "KeyCode = 0"
Set mdl = frmCurrent.Module
lngReturn = mdl.CreateEventProc("KeyDown", strCtlName)
mdl.InsertLines lngReturn + 1, strLine
exit_CreateKeyDownEvent:
Exit Sub
error_CreateKeyDownEvent:
MsgBox Err & " :" & Err.Description
Resume exit_CreateKeyDownEvent
End Sub
When the code runs, an error is generated on the line
"lngReturn = mdl.CreateEventProc("KeyDown", strCtlName)"
The error code is 57017, Event Handler is Invalid.
I've searched high and low, but haven't had any success in
determining why the error is happening and how to avoid it.
Can anyone point me in the right direction?
What's the value of strCtlName within the procedure? I get that error
if I pass a zero-length string for the strCtlName argument. If I pass a
valid control name, it works for me.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
.
- Follow-Ups:
- Re: CreateEventProc error
- From: Dirk Goldgar
- Re: CreateEventProc error
- References:
- Re: CreateEventProc error
- From: Dirk Goldgar
- Re: CreateEventProc error
- Prev by Date: Re: using combo boxes to filter records in a subform
- Next by Date: Re: Combo Box needed, entering any part of a field
- Previous by thread: Re: CreateEventProc error
- Next by thread: Re: CreateEventProc error
- Index(es):
Loading