Results 1 to 6 of 6
  1. #1
    sk88 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    183

    Exit without saving Subform

    I have a main form and a subform to it.
    There is a command button in the main form for 'Exit without saving'. Some of the fields in the main form and subform is in required fields.
    Here is the code I have so far:


    Private Sub Command31_Click()

    Code:
    If MsgBox("Are you sure you want to exit without saving?", vbQuestion + vbYesNo, "Delete Record") = vbNo Then Exit Sub
    
    Me.Undo
    
    DoCmd.Close
    DoCmd.OpenForm FormName:="fdlgSearch"
    
    
    End Sub
    The code works perfectly fine if I have started answering some questions in the main form only but it did not work when I start to answer questions in the subform and when I try to save and exit.

    It tells me that I need to answer some fields before I exit. How do I get the subform to be working?

    Please help.

    Thanks in advance

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The SubForm *will* save any changes when you move the focus back to the MainForm. Does that help?

  3. #3
    sk88 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    183
    Quote Originally Posted by RuralGuy View Post
    The SubForm *will* save any changes when you move the focus back to the MainForm. Does that help?
    Hi RuralGuy... what do you mean by move the focus back to MainForm? Did you mean I should click on to a field in the Mainform then hit the EXIT command? If so, I tried that and it did not work. It tells me that some of the mandatory fields in the subform are not completed. :S

    any other thoughts? thanks..

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Just attempting to press a button on the MainForm will move the focus to the MainForm and "save" any changes in the SubForm. You will need to think the problem through carefully.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'm sorry but I did not have a solution for you. My hopes were that with the additional understanding of Access you might be able to develop a better solution; transactions maybe.

  6. #6
    sk88 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    183
    Quote Originally Posted by RuralGuy View Post
    I'm sorry but I did not have a solution for you. My hopes were that with the additional understanding of Access you might be able to develop a better solution; transactions maybe.
    Thanks RuralGuy... I'll see what I can do..

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Exit forms without saving
    By sk88 in forum Access
    Replies: 19
    Last Post: 12-19-2013, 06:04 PM
  2. exit
    By slimjen in forum Forms
    Replies: 4
    Last Post: 10-09-2011, 09:30 AM
  3. Emailing Last Record & exit handling
    By malamute20 in forum Programming
    Replies: 25
    Last Post: 08-24-2011, 05:14 AM
  4. Replies: 9
    Last Post: 09-25-2010, 10:14 AM
  5. Replies: 3
    Last Post: 08-08-2010, 05:33 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