• Automation question… (97 SR-2)

    Author
    Topic
    #397657

    Hi Everyone…

    Just curious… Can someone tell me if it is possible to execute an On Click event for a command button in a remote database…

    So far, from within one database:
    – I’ve gotten the other database to open
    – Opened a form in that database
    – Set a value for an option button to True
    – Set focus on the command button on that form

    Now all I need to do is get it to click… laugh …or the equivalent of clicking… I need the code to run for that click event…
    Can’t figure it out…

    Is this possible?
    TIA

    Viewing 1 reply thread
    Author
    Replies
    • #754655

      In general, all you do is simply execute the procedure name associated with that object. You need to be sure to have reference set to that database, but that should do it.

      • #754667

        Thanks Wendell… but the problem I’m having is with the syntax…
        This is what I have so far for the code…

        Dim acApp As Object ‘ Declare variable to hold the reference.
        Dim acDatabase As DAO.Database

        Set acApp = GetObject(“C:Documents and SettingstreaspaDesktopdb1.mdb”)

        With acApp
        .Visible = True
        .DoCmd.OpenForm “Form1”
        .Forms(“Form1”).frmOptions = 1
        .Forms(“Form1”).cmdDone.SetFocus
        ‘cmdDone_Click ‘this is where I don’t know how to enter the command… I’ve tried a few things but I can’t get it right…
        .Quit
        End With

        Set acApp = Nothing

        End Function

        P.S. This is just a sample… Not the real thing…

        • #754681

          Have you tried replacing
          .Forms(“Form1”).cmdDone.SetFocus
          by
          .Forms(“Form1”).cmdDone_Click

          This is just a hunch.

        • #754682

          Have you tried replacing
          .Forms(“Form1”).cmdDone.SetFocus
          by
          .Forms(“Form1”).cmdDone_Click

          This is just a hunch.

          • #754683

            Thanks Patt, but that’s one of the things I tried… sad
            I get error ‘Runtime Error 2465 – Application-defined or Object-defined error”

            • #754697

              If you look at the code behind cmdDone_Click you will probably find that it is private which means that this procedure is not visible and available outside this form.
              Changing private to public made it work for me.

            • #754933

              doh … Ahhh… The scope… I should have thought of that…
              Thanks a million John!
              thankyou

            • #754934

              doh … Ahhh… The scope… I should have thought of that…
              Thanks a million John!
              thankyou

            • #754698

              If you look at the code behind cmdDone_Click you will probably find that it is private which means that this procedure is not visible and available outside this form.
              Changing private to public made it work for me.

          • #754684

            Thanks Patt, but that’s one of the things I tried… sad
            I get error ‘Runtime Error 2465 – Application-defined or Object-defined error”

      • #754668

        Thanks Wendell… but the problem I’m having is with the syntax…
        This is what I have so far for the code…

        Dim acApp As Object ‘ Declare variable to hold the reference.
        Dim acDatabase As DAO.Database

        Set acApp = GetObject(“C:Documents and SettingstreaspaDesktopdb1.mdb”)

        With acApp
        .Visible = True
        .DoCmd.OpenForm “Form1”
        .Forms(“Form1”).frmOptions = 1
        .Forms(“Form1”).cmdDone.SetFocus
        ‘cmdDone_Click ‘this is where I don’t know how to enter the command… I’ve tried a few things but I can’t get it right…
        .Quit
        End With

        Set acApp = Nothing

        End Function

        P.S. This is just a sample… Not the real thing…

    • #754656

      In general, all you do is simply execute the procedure name associated with that object. You need to be sure to have reference set to that database, but that should do it.

    Viewing 1 reply thread
    Reply To: Automation question… (97 SR-2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: