Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Aug 2001
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Retrieve values from an instance of a class form (Access 97 / SR-2)

    I have a simple class form that I created that prompts for a start date and an end date. I would like to from a main form, click on a command button that starts an instance of the class form for the user to enter the date values. So far, so good. What I can

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Retrieve values from an instance of a class form (Access 97 / SR-2)

    If you use the WithEvents keyword and declare your form object in the calling form's module as a module level object variable, you can simply read the values from the popup form without having to send anything back to the main form. Just trap the close event of the popup form in the main form's module and grab the information in that routine. Is that the way you're trying to do it now? If you are having problems making that work, post the code you use to instantiate the popup form so we can help you work it out.
    Charlotte

  3. #3
    New Lounger
    Join Date
    Aug 2001
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Retrieve values from an instance of a class form (Access 97 / SR-2)

    Thank you for your response. I don't know how to trap the close event of the popup form in the main form'
    s module. Do you have any code snippits that might show me how to do it?
    TIA
    Jen

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Retrieve values from an instance of a class form (Access 97 / SR-2)

    There's an A97 demo database attached to <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Cat=&Board=acc&Number=18631&page=& view=&sb=&o=&vc=1#Post18631>this post</A> that demonstrates using WithEvents. In that example, a form is controlling a report and monitoring the close event of the report, but the principle is the same with another form. If you need help, post again.
    Charlotte

  5. #5
    New Lounger
    Join Date
    Aug 2001
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Retrieve values from an instance of a class form (Access 97 / SR-2)

    Thank you for all of your help. We have been working on this and have been able to trap the form close event and even have been able to trap the on-click event on a command button on an instance of a form.

    The one thing we can not get to work for some reason is to trap the on open event for an instance of a form.

    It's probably something really silly that we are overlooking. Any suggestions or ideas would be greatly appreciated.?

    TIA,
    Jen

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Retrieve values from an instance of a class form (Access 97 / SR-2)

    What are you trying to do that isn't working? The Access 97 sample I pointed to in an earlier post demonstrates trapping the OpenEvent of frmCustomerOrders from frmControlForm. Look under mFrm in the code module for frmControlForm and you'll find an mFrm_Open sub that traps the Open event of the form assigned to the mFrm variable.
    Charlotte

  7. #7
    New Lounger
    Join Date
    Aug 2001
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Retrieve values from an instance of a class form (Access 97 / SR-2)

    Unfortunately, I am not able to see the frmControlForm or frmCustomerOrders forms in the WithEvents.mdb sample file you've provided. I only see the form "frmControlRept". I would like to see the code but, I guess my question at this point is... Do you do anything different to trap the on open event on a form verses the on close event? With your previous help, we are able to successfully trap the on close event and are trying to use similar code to trap the on open event for a form. And the code in our new on open event never runs.

    Sorry to be a bit thick on this. I really appreciate your assistance with this matter.

    Jen

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Retrieve values from an instance of a class form (Access 97 / SR-2)

    Sorry, I forgot I had stripped that one down in order to fit it in the 100K file limitation. I'm attaching a 97 database that includes the forms I mentioned. However, I don't understand why you want to *do* with the Open event of the form. When you're using automation, you normally set everything up before you trigger the open event of the form.
    Attached Files Attached Files
    Charlotte

Posting Permissions

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