Reset Option Group

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rhonda6373
    New Member
    • Mar 2010
    • 35

    #1

    Reset Option Group

    I have an option group that filters a subform. It is filtering correctly except that when I select a value and close the database, it filters on that same value instead of the default when I open the database again.

    So for example -- the default is All. I select Pre Installed and the subform is filtered correctly. I close the database and re-open. The subform is still filtered for Pre Installed records although the All button is selected correctly.

    Here is the code for the on click event. The Accounts query is an append query. I am trying to work on someone elses DB and it has been over 10 years since I had VB. I know it is probably something simple.

    Code:
    CurrentDb.Execute ("Delete * from AccountList")
    DoCmd.SetWarnings False
    DoCmd.OpenQuery ("QryAccounts")
    DoCmd.SetWarnings True
    
    Forms!Default!NavigationSubform.Requery
    Thanks.
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    #2
    The obvious question would be is the option group bound to some data item? And barring that, what references to this option group are there in the code? Anything that might be trying to apply a value to the group?

    For an override, you could try setting the option group to the default in the OnClose event of the form.

    Jim

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32669

      #3
      Rhonda.

      Your question is about the filtering being saved with the form design, yet the code you include isn't related to that??

      Please post the relevant code and we can help you figure out the problem.

      How to Close a Main Form Without Saving Changes of any Subforms may be of interest.

      Fundamentally you really don't want to allow design changes to be saved to the object when it closes. If we could see what you're actually doing we could offer more focused advice, but that's the general point you need to consider.

      Comment

      • rhonda6373
        New Member
        • Mar 2010
        • 35

        #4
        Thanks everyone for the input! I did figure this out.

        Comment

        • zmbd
          Recognized Expert Moderator Expert
          • Mar 2012
          • 5501

          #5
          rhonda6373
          Would you mind sharing?

          Comment

          Working...