Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    robs23 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    109

    I gave it some additional testing and it seems that factory.filter (public instance of my object stored on standard module factory) gets cleared somewhere between creating and displaying main form. I've checked and factory.filter still points to my instance at subform's load and current event. When main form (containing this subform) is displayed, factory.filter points to Empty or Nothing. Don't know why it gets cleared and why it happens only in case vba creates the form & subform - if I run the same code but using previously created forms factory.filter won't loose the pointer to instance of clsFilter. Any ideas what's wrong or how I could test it any more?

  2. #17
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,934
    I've been able to open the file, but struggling to follow the code - lack of documentation doesn't help

    However I added 'Option Explicit' to all modules and tried to compile and there are a number of variables/objects not declared which may be having an impact

    Don't know why it gets cleared and why it happens only in case vba creates the form & subform
    Being unable to follow the code, just a thought.. subforms are objects of the main form, not a form in their own right

  3. #18
    robs23 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    109
    Thank you for all you pointers - I've corrected errors, added Option explicit and error handling to all subs and functions. It hasn't changed a bit, though.


    Actually I think the issue is much simpler than it seems - it has nothing to do with my code really. All what this is about boils down to this public variable


    Code:
    Public filter As clsFilter
    in "factory" module. It keeps the pointer to the instance of clsFilter I created. We have to consider 2 cases:

    1. All forms (including filter's main form & its subform) are created during the runtime of code
    2. Forms are present (hence not created once more)




    At 1) factory.filter holds the pointer to the instance of clsFilter as long as sub "xxx" runs. When it ends, something happens that turns factory.filter to Nothing
    at 2) factory.filter holds the pointer to the instance of clsFilter even after "xxx" has finished.


    This is the real source of the problem. In spite of the fact that main filter form opens as soon as it's called, it starts displaying anything after the main sub ("xxx") has finished. I did some loop to prove it. The loop took about 15 seconds to finish, main filter form appeared right away as usual (but it was all blank form with only the title bar) and all the subforms loaded after 15 seconds when "xxx" has finished..


    Why factory.filter is turned to "Nothing" in case 1? I don't do that in code anywhere, so it must be associated to the way new form are being saved and opened..


    Robert

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Run a previously created Multiple times for a date range
    By unreal_event_horizon in forum Programming
    Replies: 3
    Last Post: 08-29-2014, 09:06 AM
  2. Replies: 3
    Last Post: 10-18-2012, 02:25 PM
  3. Replies: 2
    Last Post: 06-15-2012, 07:41 PM
  4. Replies: 3
    Last Post: 05-26-2011, 12:52 PM
  5. Replies: 10
    Last Post: 11-09-2010, 03:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums