Results 1 to 3 of 3
  1. #1
    altemir is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012

    Preventing "Save Changes to Design" Prompt When Changing Recordsource

    I know this is not a new topic but previous posts don't seem to help ...

    I have a navigation subform in Access 2010. When you click on a tab in the navigation subform ("NavigationSubform"), it displays another form ("Form1") and its subform ("Subform1"). I change the recordsource of Subform1 programatically based on various combobox values using VBA as follows:
    Forms!frmMain!NavigationSubform!ContainerForm1.For m.RecordSource = "SELECT * FROM yada yada ... "
    Forms!frmMain!NavigationSubform!ContainerForm1.For m.Requery

    That part works fine. However, I have a double click event in one of the text box controls in Subform1 that causes the focus to move to another tab in the navigation subform. I use the following code to achieve this:
    DoCmd.BrowseTo acBrowseToForm, "Form2", "frmMain.NavigationSubform"

    When the user double clicks on this field, he gets a "Do you want to save changes to the design of 'Subform1'" prompt. I assume that assigning a new recordsource to the subform is the "change" it's referring to.
    How can I stop this annoying message?

    I tried putting the "DoCmd.Close acForm, Me.Name, AcSaveNo" statement in the close event of Subform1, but then I get a surprising error (to me) that claims that Subform1 is not open. What else can I do?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    did you try the command: docmd.setwarnings false

  3. #3
    altemir is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Thank you!!! You helped me solve it! But there's a little bit more to it ...

    I did have "DoCmd.SetWarnings False" in the Enter event of each subform's navigation tab button and "DoCmd.SetWarnings True" in each subform's Open event. I thought this would be enough, but it isn't. So now I have the following and it seems to work:

    1) Add "DoCmd.SetWarnings False" to Enter event of each subform's navigation tab button
    2) Add "DoCmd.SetWarnings False" to Open event of each subform
    3) Add "DoCmd.SetWarnings False" to Open event of the main form that contains the navigation subform

    This ensures that warnings are turned off when moving between navigation tabs. It may also be important to turn the warnings back on during code execution just to trap any possible errors.

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

Similar Threads

  1. Replies: 1
    Last Post: 09-03-2014, 03:27 AM
  2. Replies: 0
    Last Post: 08-23-2013, 08:12 AM
  3. "Are you sure you want to quit Prompt"
    By Mclaren in forum Programming
    Replies: 1
    Last Post: 10-21-2012, 03:12 PM
  4. Replies: 13
    Last Post: 07-27-2011, 12:38 PM
  5. Replies: 3
    Last Post: 03-07-2011, 08:37 PM

Tags for this Thread

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