Results 1 to 13 of 13
  1. #1
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904

    Forcing Refresh/Data Changes Saved in Mutli-Tabbed Form

    I have a multi-tabbed Data Entry Form in one of my databases.
    Is there a way to commit/save all data changes on the event of switching from one tab to another?


    I have some tabs that are dependent on certain check boxes being selected on other tabs, and if users select the check box, it doesn't enable the fields on the other tabs right away (unless they switch records which then triggers the update to be written, and then come back into it).

    I could use the After Update Event on each particular check box field, but would prefer if there was just a way to "force" save/commit all changes upon the movement from one tab to another.

    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I just tried the Click event of tab control as well as the tab page and nothing happens. Weird. Why is it there if it does nothing?

    Just saving the record will not enable the other fields unless you are using Conditional Formatting.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Just saving the record will not enable the other fields unless you are using Conditional Formatting.
    It isn't that kind of enable sort of thing. It is more creating the records that link to the other tables sort of thing.
    I'll just try putting a "Me.Refresh" line in the After Update event of that one field. I was hoping I could do that on the switching of a tab, but it does not look like that is an option.

    Thanks

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Refresh will not requery the form's recordset/tables. Using Me.Requery will bring the user to the forms first record. Maybe an acSave command or something.

    You can reference tabs in a Tab Control by using the control's tab indexes. Me.TabControl.Value = 2. So you could requery specific controls using the tab control's click event handler. In the click event you could place a Select Case statement.

    Case tab.value = 2 Me.cboCust.Requery

  5. #5
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Interestingly, when I just tried the Me.Refresh, before I used it, it would show the "pencil" icon, indicating that the Access record hadn't been saved or committed yet.
    But after I added the Me.Refresh, that icon went away, indicating that the record had been saved. So I think that *seems* to do what I want...

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    The way I understand it..... Exiting a bound control will change the value in the table. Saving a record will eliminate the form's memory of the changes you made. Ctrl + Z or Undo will not be effective after you save a record or navigate to a new record within a recordset.

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    As you have discovered, the "Click" event of a Tab Control is pretty much useless. That is why we use the Change Event of the Tab Control instead which does fire every time you change tabs.

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by RuralGuy View Post
    As you have discovered, the "Click" event of a Tab Control is pretty much useless......
    My experience with the click event handler for tab controls has always been positive. Clicking any tab on the control fires the code in this example that uses the click event handler.
    Attached Files Attached Files

  9. #9
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    That is why we use the Change Event of the Tab Control instead which does fire every time you change tabs.
    I think that is precisely what I was looking for! I was looking in the wrong place (at each individual tab instead of the Tab control).
    Thanks!

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    ItsMe - I tried your sample db, nothing happens with Access 2007. The Click event is non-functional, however Change does the trick. Thank you M$!
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by ItsMe View Post

    ...Clicking any tab on the control fires the code in this example that uses the click event handler...
    That's odd! Your example doesn't work when I download and run it, and, as Allan suggested, this kind of code never has!

    Linq ;0)>

  12. #12
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Yup, I must be getting too comfortable with A2010. I did a quick study with a new control in A2003 and discovered the click event kinda functions. The problem is, it only functions outside of the page and outside of the tabs! You have to click in the header, so to speak.

  13. #13
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by Missinglinq View Post
    That's odd! Your example doesn't work when I download and run it, and, as Allan suggested, this kind of code never has!

    Linq ;0)>
    I just tested that DB again in A2010. It does work when the tab is clicked. I did not consider different versions until June mentioned 2007. Crazy stuff. Maybe they switched it back for 2013.

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

Similar Threads

  1. Tabbed form for survey data entry
    By CluelessAccess101 in forum Forms
    Replies: 11
    Last Post: 02-13-2013, 12:03 PM
  2. Subform Refresh in a Tabbed Main Form
    By theosgood in forum Forms
    Replies: 5
    Last Post: 06-22-2012, 10:12 AM
  3. Replies: 1
    Last Post: 12-21-2011, 02:11 PM
  4. Data disappears on form once saved
    By becks in forum Forms
    Replies: 1
    Last Post: 11-27-2011, 09:04 AM
  5. Opening Saved data in form in Edit mode
    By l3111 in forum Forms
    Replies: 7
    Last Post: 06-06-2011, 11:37 AM

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