how to save the database in vba?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • plynius schull
    New Member
    • Jan 2012
    • 5

    how to save the database in vba?

    Hi,

    I dont seem to find a way to save the current database in Access, I just want to do same thing as the Save-button or save-as-button of Access, is there some kind of VBa-code?
    like currentdatabase .save???

    In fact I want to make an automatic back-up routine, and thought to do this by saving ervy 10 minutes to another name and saving back to the original...
    I have had problems myself with access and losing much data...

    thx
  • Mihail
    Contributor
    • Apr 2011
    • 759

    #2
    Is no reason to do that because each time a record is updated all modifications are saved automatically. You do not risk to loose data as in Excel (for example) where is needed to push the Save button after you modify something in the sheet.

    Comment

    • plynius schull
      New Member
      • Jan 2012
      • 5

      #3
      hi,

      I wanted to make a back-up system, so safe the file to another name. Or is there another way to do so?

      thanks for answering my question

      Comment

      • Mihail
        Contributor
        • Apr 2011
        • 759

        #4
        Copy the file then rename it as you wish.

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32653

          #5
          There is no such facility in Access Plynius. You would need to make a copy of the whole database file (when it's not in use preferably).

          Comment

          • Seth Schrock
            Recognized Expert Specialist
            • Dec 2010
            • 2965

            #6
            If you do backups on your computer, just add the folder that contains the database to the backup list. There are many options for backing up a file of any kind automatically. You can do online backups through websites such as dropbox.com which backs up the selected folders whenever there is a change. You can also use the backup tools that come with Windows OS and Mac OS. I'm pretty sure that Linux also comes with a built-it backup tool. All you would need is an external hard drive or another computer. You can then do scheduled backups. Do a Google search for how to back up your computer and you will find many options. If your computer is backed up and your computer crashes, then you can restore your database from the backup. However, like NeoPa said, this isn't done through Access.

            Comment

            • TheSmileyCoder
              Recognized Expert Moderator Top Contributor
              • Dec 2009
              • 2322

              #7
              There are things you can do from within access, but it depends on the nature of your application. Are you the only user, or are there multiple users for instance?

              In some cases it could be as simple as having a procedure that creates a copy of the database when the user logs on.

              Another option could be to use a system like KeepIt.Com for taking online backup.

              I would not recommend DropBox for taking backup. If you have your db located in a dropbox synchronized folder it can severely affect performance and increase the risk of corruption.


              If corruption is the main cause of your data loss, I can add that I used to experience a fair share of database corruption in Ac2003, but after following these simple steps I have had no corruption since then:
              1. Never edit running code. If your in debug mode, its fine to see where the error is occuring, but after you've viewed the location, kill the process.
              2. Do your edits, then Compile.
              3. Only run compiled code.

              Comment

              • Mihail
                Contributor
                • Apr 2011
                • 759

                #8
                Good to know, Smiley !

                Comment

                • plynius schull
                  New Member
                  • Jan 2012
                  • 5

                  #9
                  Thx for the hints everyone, Im trying just to copy the file automaticaly in access every 15 minutes...

                  Comment

                  Working...