Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    shelzmike is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2010
    Posts
    22
    Okay thanks. I will look up how to do that later on to see if I can figure that out.

  2. #17
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Just a hint - it would require a flag which is set in the Before Update event which the Unload event would then check.

  3. #18
    shelzmike is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2010
    Posts
    22
    Let me throw out the logic that I am thinking and let me know if I am close or way off here.

    So, I suppose I need to add another Else If statement to cover if Cancel is clicked and set it to, say, true. Then in on unload I need to check that flag to see if it is true and if it is, then do not close the form?

    But wait, these are private subs, so the variables can't be passed among one another right? Or am I off there as well?

    Mike

  4. #19
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by shelzmike View Post

    So, I suppose I need to add another Else If statement to cover if Cancel is clicked and set it to, say, true. Then in on unload I need to check that flag to see if it is true and if it is, then do not close the form?
    Close - a Select Case statement would be better than a bunch of If's and/or elseifs.

    And you are correct about the checking of the flag and then you would issue a

    Cancel = True

    in the Unload event.

    But wait, these are private subs, so the variables can't be passed among one another right? Or am I off there as well?
    Scope is something to be aware of. When you have a form module, you can declare it private but that limits the scope to the form module itself. So, while you have a variable that is declared

    Private blnNoClose As Boolean

    in the General Declarations Section of the form. Then it can be accessed by any event in that form. When it is declared inside a procedure, then it is only available to that procedure. But since you would declare it in the General Declarations Section (up just below where the Option Compare Database and Option Explicit are at) then it can be used by any event there in THAT form.

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

Similar Threads

  1. Replies: 2
    Last Post: 06-20-2011, 03:10 PM
  2. OLE object not written to database
    By Jean-Louis Leroy in forum Forms
    Replies: 0
    Last Post: 06-08-2010, 02:08 AM
  3. Close All but One Form
    By Bruce in forum Forms
    Replies: 4
    Last Post: 04-06-2010, 09:31 AM
  4. Replies: 1
    Last Post: 01-30-2010, 04:45 PM
  5. close form
    By taylorosso in forum Forms
    Replies: 5
    Last Post: 08-25-2009, 12:18 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