Close Form after New Form Opened

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Medlar
    New Member
    • Aug 2010
    • 7

    Close Form after New Form Opened

    I am also finding some difficulty with making my find client number form auto close when the client form opens.
    I have tried adding code at the end of the private sub to open the client form and have also tried putting it in for example 'On Lost focus'.
    All seem to fail and return an error message.
    Some advice on the correct way to approach this problem would be much appreciated
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32662

    #2
    This thread has been created by splitting off a new question from another thread (code to set the value of a query as the value in a control).

    When I've finished tidying up I will return to offer an answer.
    Last edited by NeoPa; Oct 14 '10, 02:43 PM.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32662

      #3
      Like you, I prefer a clean/tidy interface, and when control is passed from one form to another, I like the first to disappear leaving no confusion as to where the operator is at, at any time. This doesn't seem to be provided easily though. Let me give you some ideas to consider.

      In a hierarchical structure, which I prefer - particularly for my menu systems, it is necessary for the menus earlier in the process to return, after the sub-menus (Not referring to Access Sub-Forms here) have been finished with, to the point of departure. In other words, to the point they were at just prior to relinquishing control to the sub-menu. For this to occur then, rather than closing the form, it need simply be hidden. When the called form (sub-menu) gets closed, it should be programmed to unhide the form that called it into being.

      For closing the form, should you decide you still need to, you haven't posted any examples of code you've tried. That would have been helpful. However, the simple code is :
      Code:
      Call DoCmd.Close()
      This can be more powerful, but when called with no parameters, closes the object where the code is found.

      Comment

      Working...