Results 1 to 2 of 2
  1. #1
    Bennet is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    5

    Question Save Subform Changes

    Sendkeys "^s" - Ctrl-S to save the app isn't working.




    I need to get access to save layout changes made by a user to a subform.

    I have a subform and some controls on the main form that alter the layout of the subform - some checkboxes that hide and unhide the columns.

    I also have a button that exports the current contents of the subform to excel.

    DoCmd.OutputTo acOutputForm, "MySubForm", acFormatXLS, OutputPath, AutoStart:=-1 (Very happy with how this works!)

    The problem is that if the user hides or unhides columns using my checkboxes, these changes are not picked up by the export to Excel until the user saves the subform by closing the form.

    So I need some code that forces changes made to the subform to be saved, without closing the subform.

    DoCmd.Save acForm, "MySubForm" - doesn't work "RunTime Error 2489 - The object isn't open."

    What DOES work is clicking the save button in the top left corner of the access application.

    But I can't find any code that mimics this button.

    Sendkeys "^s" for some reason doesn't do anything at all.

    Can anyone provide code that mimics the main SAVE button in access, or code that will specifically force my subform to save layout changes as it would when closing?

  2. #2
    Bennet is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    5
    Seems the sendkeys solution works if you first set focus to the subform.

    I would be interested if anyone knows how to get DoCmd.Save, acform to work for a subform though. This would be a more reliable solution, I think.

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

Similar Threads

  1. Replies: 5
    Last Post: 11-16-2011, 07:30 PM
  2. Replies: 7
    Last Post: 07-15-2011, 01:58 PM
  3. locking data in subform after record save
    By Nixx1401 in forum Forms
    Replies: 24
    Last Post: 05-31-2011, 01:48 PM
  4. Replies: 9
    Last Post: 01-20-2011, 02:22 PM
  5. Replies: 2
    Last Post: 01-29-2010, 11:33 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