Results 1 to 6 of 6
  1. #1
    Barbados is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    4

    Switching Between Navigation Forms Resets All Values To Default

    Hi,

    I have a navigation form (called frmNavigation) with 3 navigation buttons. I have a 'normal' form (called frmMain) which I dragged onto the first navigation button.

    So my navigation button 1 now contains many items, one of which is a combobox. Suppose the choices for this combo box are apples, pears and oranges and the default value is apples.



    Now, suppose I select oranges in this combo box (on navigation button 1). Suppose now I click on navigation button 2 (or 3) and then go back to navigation button 1 again. Then the value of the combo box is always reset to its defaults value, thus apples. How can I ensure that oranges stay selected?


    Thus basically, switching between navigation forms resets all values to default. How to avoid this?

    Thanks.

  2. #2
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    In the AfterUpdate of the combo box, you can set the combo box's Default property to the selected value.

    The codes in post #13 in this thread https://www.accessforums.net/forms/advancing-new-record-35364.html

  3. #3
    Barbados is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    4
    Quote Originally Posted by Dal Jeanis View Post
    In the AfterUpdate of the combo box, you can set the combo box's Default property to the selected value.

    The codes in post #13 in this thread https://www.accessforums.net/forms/advancing-new-record-35364.html
    Thanks for your suggestion. Unfortunately, this is not working. Anyone any idea why combo box values are reset to default when switching back and forth between navigation forms?

  4. #4
    Barbados is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    4
    Quote Originally Posted by Dal Jeanis View Post
    In the AfterUpdate of the combo box, you can set the combo box's Default property to the selected value.

    The codes in post #13 in this thread https://www.accessforums.net/forms/advancing-new-record-35364.html
    Thanks for your suggestion. Unfortunately, it is not working. Any other ideas? Why would it reset to default value in the first place?

  5. #5
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Ah, here's the problem - you're in that newfangled Access, using navigation forms, and when you switch tabs, the other tab's form is unloaded.

    http://answers.microsoft.com/en-us/o...8-1a29afc7adeb

    So, I guess you'll have to tweak something.

    Hmmm. You could set a global or temp variable, and have the combo box default to whatever value that temp variable has. That seems awfully clunky, though, since (if I envision it correctly) you'd have to create/load the temp variable on startup, or test for existence, or something.

    Hmmm. Okay, (1) on load for the form, check for existence of the temp variable, if so, leave alone, if not, create it and set the value to your initial default. (2) make the default property of the combo box refer to that temp variable (3) AfterUpdate of the combo box, set the value of the temp variable to the new default.

    It's not pretty, and from a quick google I couldn't find the code for testing the existence of a temp variable, so you may have to wait for one of the more experienced moderators to give you a better method.

  6. #6
    Barbados is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    4
    Quote Originally Posted by Dal Jeanis View Post
    Ah, here's the problem - you're in that newfangled Access, using navigation forms, and when you switch tabs, the other tab's form is unloaded.

    http://answers.microsoft.com/en-us/o...8-1a29afc7adeb

    So, I guess you'll have to tweak something.

    Hmmm. You could set a global or temp variable, and have the combo box default to whatever value that temp variable has. That seems awfully clunky, though, since (if I envision it correctly) you'd have to create/load the temp variable on startup, or test for existence, or something.

    Hmmm. Okay, (1) on load for the form, check for existence of the temp variable, if so, leave alone, if not, create it and set the value to your initial default. (2) make the default property of the combo box refer to that temp variable (3) AfterUpdate of the combo box, set the value of the temp variable to the new default.

    It's not pretty, and from a quick google I couldn't find the code for testing the existence of a temp variable, so you may have to wait for one of the more experienced moderators to give you a better method.
    Not sure if I want to go through all the trouble to make that work. I guess I gonna switch back to Pages on a Tab Control. But great find, thanks!

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

Similar Threads

  1. Replies: 2
    Last Post: 04-21-2013, 08:03 AM
  2. Replies: 5
    Last Post: 09-05-2012, 06:42 PM
  3. Replies: 3
    Last Post: 07-30-2011, 09:12 PM
  4. Switching Values in text box????
    By reidn in forum Forms
    Replies: 2
    Last Post: 07-08-2011, 02:04 PM
  5. Replies: 1
    Last Post: 09-15-2010, 07:34 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