Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6606983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:27:15+00:00 2026-05-25T19:27:15+00:00

I was hoping to save all open MS Access documents via a JScript run

  • 0

I was hoping to save all open MS Access documents via a JScript run from the Windows Script Host.

So far I was able to obtain the MS Access object by calling:

var objAccess = GetObject('', "Access.Application");

But now I’m stumped. If it was MS Word, I’d enumerate all open documents in the .Documents property and call Documents.Item(n).SaveAs() method on each of them.

But how do you save-as all open documents in MS Access?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:27:15+00:00Added an answer on May 25, 2026 at 7:27 pm

    After you have your object variable set to an Access application instance with GetObject, use its Quit method with the acQuitSaveAll option (value = 1). Not sure about JScript; in VBScript, I can do it like this.

    Dim objAccess
    Set objAccess = GetObject(,"Access.Application")
    WScript.Echo objAccess.CurrentDb.Name
    objAccess.Quit(1) ' acQuitSaveAll
    Set objAccess = Nothing
    

    Note, when I used GetObject as in your example, objAccess was a new Access application instance rather than a reference to the instance which was running previously. So, with the GetObject line like this …

    Set objAccess = GetObject('', "Access.Application")
    

    … the WScript.Echo line threw an error with CurrentDb.Name (because there was not a database open in that Access application instance.

    This approach will save any changes to database objects (tables, forms, reports, etc.) which were in design mode but not saved. However if a user has any unsaved changes to data in a form, those changes will be discarded despite the acQuitSaveAll option. It seems that option only applies to objects, not data.

    Edit: If that approach is not satisfactory, you can do something more sophisticated with VBA in your Access applications, as @Remou mentioned in his comment. An example is KickEmOff from Arvin Meyer. He also offers a sample database which demonstrates that code in action.

    Edit2: Remou’s comment got me thinking acQuitSaveNone (value = 2) should be safer than acQuitSaveAll … the unsaved object changes would be discarded, but at least you would be less likely to save an object in a non-functional state.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to open an XML file exclusively, make a modification, and save it.
Fairly basic question i'm hoping. In the following javascript, I want to run the
I want to save files from an external server into a folder on my
This is all i'm looking for at a high level: The ability to run
Hoping someone can provide an answer with this, although it's not 100% programming related.
Hoping someone can help me with a slight hurdle I've come up against in
Hoping that anybody here knows about a good one: I'm looking for a (free
Hoping some learned Rails developers here can recommend an existing Ruby on Rails plugin
Hoping someone can shed some light on this: Do lookup tables need their own
Hoping someone can point me in the right direction. I'm building a online shop

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.