Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326

    Unanswered: Calling Form Code from a Different Form

    Hey!

    I'm sure I'll kick myself, but I really can't remember how to call a form's code when I'm in a different form.

    Situation:
    -----------
    I have a continuous subform of participant info based on a participant table with NameCode as a primary key on a Tournament form. Subform is joined by date, etc.

    There is code on the NameCode combo box (AfterUpdate) that Dlookups things like name, phone number, etc for the remainder of the record.

    On the subform, I have a button to open a datasheet of all participants. There is code on that datasheet (NameCode_DoubleClick) that properly puts the NameCode onto the subform's record that called it. I hope that makes sense.

    What I can't do:
    ------------------
    I want to call the AfterUpdate routine of the NameCode combo box on the subform when it is double clicked on the datasheet.

    Help, please?

    TIA!
    All code ADO/ADOX unless otherwise specified.
    Mike.

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Calling Form Code from a Different Form

    Originally posted by HomerBoo
    Hey!

    I'm sure I'll kick myself, but I really can't remember how to call a form's code when I'm in a different form.

    Situation:
    -----------
    I have a continuous subform of participant info based on a participant table with NameCode as a primary key on a Tournament form. Subform is joined by date, etc.

    There is code on the NameCode combo box (AfterUpdate) that Dlookups things like name, phone number, etc for the remainder of the record.

    On the subform, I have a button to open a datasheet of all participants. There is code on that datasheet (NameCode_DoubleClick) that properly puts the NameCode onto the subform's record that called it. I hope that makes sense.

    What I can't do:
    ------------------
    I want to call the AfterUpdate routine of the NameCode combo box on the subform when it is double clicked on the datasheet.

    Help, please?

    TIA!
    Well 1st is the AfterUpdate method has to be declared Public ... Then try: Forms![Subform Name].comboboxname.afterupdate

    You might have to drill down thru the subform control to do this ...

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Ok ... I had to find where I did the same thing ... Ex:

    Forms![Customer Review].RefreshButton_Click

    All I did was make the method Public ...

  4. #4
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile Re: Calling Form Code from a Different Form

    Originally posted by HomerBoo
    Hey!

    I'm sure I'll kick myself, but I really can't remember how to call a form's code when I'm in a different form.

    Situation:
    -----------
    I have a continuous subform of participant info based on a participant table with NameCode as a primary key on a Tournament form. Subform is joined by date, etc.

    There is code on the NameCode combo box (AfterUpdate) that Dlookups things like name, phone number, etc for the remainder of the record.

    On the subform, I have a button to open a datasheet of all participants. There is code on that datasheet (NameCode_DoubleClick) that properly puts the NameCode onto the subform's record that called it. I hope that makes sense.

    What I can't do:
    ------------------
    I want to call the AfterUpdate routine of the NameCode combo box on the subform when it is double clicked on the datasheet.

    Help, please?

    TIA!
    Ditto on M's response. I set up something simple to test.

    Private Sub Command41_Click()
    Dim frm As SubForm
    Set frm = Me.sfrmEvents
    Call frm.Form.EmployeeID_DblClick(False)
    End Sub
    Gregg


    DAO, ADO, SQL, Automation and anything else I can pick up.

  5. #5
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    I thank you guys for setting up a test.

    basicmek:
    I can't use the Me keyword because the calling routine is does not contain the subform, but I will remember that for cases when it does. I haven't seen the SubForm object type in VBA before

    M Owen: Yup, worked, but had to use Form_frmAttendance.cboNameCode_AfterUpdate as appears in the Project Explorer window.
    All code ADO/ADOX unless otherwise specified.
    Mike.

Posting Permissions

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