Results 1 to 3 of 3

Thread: CreateEventProc

  1. #1
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Unanswered: CreateEventProc

    How could I create an Event Procedure for the Form Open?
    I can create it for a Button onClick

    Thanks

  2. #2
    Join Date
    Feb 2004
    Location
    Dorset UK
    Posts
    147
    Are you trying to call code thats in a form ? or want to call a procedure from a form or or use a form opening to trigger something.

    Sorry I'm not great at understand things and I want to help.

    Ken.

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Originally posted by Ken_Hart
    Are you trying to call code thats in a form ? or want to call a procedure from a form or or use a form opening to trigger something.

    Sorry I'm not great at understand things and I want to help.

    Ken.
    Thank you Ken,

    It is so, From my main Form, I create another form using code putting some controls on it and command button. I could achive to write an on Click event for the command button, it functions ok. I want to write a code in the Open_Form event.

    I use something like that

    Function ClickEreignisproz() As Boolean
    Dim frm As Form, ctl As Control, mdl As Module
    Dim lngBack As Long

    On Error GoTo Error_ClickEreignisproz
    ' Neues Formular erstellen.
    Set frm = CreateForm
    ' Create Button on the Form
    Set ctl = CreateControl(frm.Name, acCommandButton, , , , 1000, 1000)
    ctl.Caption = "Click here"
    ' Form Module
    Set mdl = frm.Module
    ' Add event procedure

    lngBack = mdl.ClickEreignisproz("Click", ctl.Name)
    ' Add Text 2 the procedur Head
    mdl.InsertLines lngback + 1, vbTab & "MsgBox ""Stay Still!"""
    ClickEreignisproz= True

    Exit_ClickEreignisproz:
    Exit Function

    Error_ClickEreignisproz:
    MsgBox Err & " :" & Err.Description
    ClickEreignisproz = False
    Resume Exit_ClickEreignisproz
    End Function


    This function creates a form and a button on it, writting code for the on Click event.

    What I need to write Code for the Open_Form event.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •