• Export Database as Time/Date

    Author
    Topic
    #353870

    Does anyone have some insight as to how to make this happen via code?

    Thanks!

    Drk.

    Viewing 0 reply threads
    Author
    Replies
    • #518636

      I want it to export as 2001-03-13.mdb.. any ideas?

      Thanks!

      D

      • #518682

        Maybe if you explain what you mean by exporting a database, you’ll get some answers. You can export objects from a database, but you can’t export a database (and no, you can do a save as, either) from a database. so what exactly are you trying to do?

        • #518744

          Hmm…

          Well, if I cant *duplicate?* or make a replica of the database daily, perhaps I can export a table as time-date? or multiple tables?

          All I really need is a daily backup of the data incase my problems re-occur… (The original programmer used strictly macros, which added a whole lot of junk to the code making it unstable.. any changes made to a report or form would result in complete data corruption…)

          Hope this clarifies a bit!

          Drk.

          • #518749

            Hi Drk,

            My .Forgive me for being so bold, but why would you want to do this in Access?

            On the surface, it would appear that there are many ways to do this, such as using some program to automatically zip up a current copy of the DB and to rename the zip file to a date/time name. Even a DOS batch file can do that.

            Is there some limiting factor here that we don’t understand?

            • #518754

              Not to worry.. bold is good!

              The problem is in the user base. If I can make Access do this ‘behind the scenes’ that would be preferrable. Because a DOS batch file or other outside resource requires another file, My concern is that it wont work if changes are made to file locations, etc..etc..etc… There’s also a security factor.. although anyone can get the data if they want it, I don’t want to blatently announce the locations of the data by writing a batch file, as the data is sensitive.

              Hope that helps!

              Drk.

            • #518755

              Just a thought.

              Just prior to the Application.Quit, (using code, of course) open up another .mdb file which would contain the copydb code. You can then fire the code in the open event of the startup form (or autoexec macro, if you must). Be sure to check for the abscence of the matching .ldb to ensure noone else is using the mdb (thereby possibly losing data among other problems)

            • #518758

              First i’d need to know how to do this, what would be the best way to, within access, backup my data as Time/Date?

              Thanks!

            • #518765

              The easiest would be, (in access) run a shell command such as the following:
              Shell “c:program fileswinzipwinzip32.exe -min -a ” & fullPathAndFilenameToCreate & ” ” & fullPathAndFilenameToZip
              which would create a.zip file containing the .mdb and name it whatever name you assign to the fullPathAndFilenameToCreate variable
              This assumes you have a liscenced copy of winzip in the difined location

            • #518774

              I want to do this within access, without the use of winzip.. Because this is a network app, and Winzip is always on the local machine, it would be impossible to specify the correct location of Winzip on each computer…

              Does anyone have any idea how to do this in Access?

              Drk.

            • #518781

              I was trying to hold out on you, but….

              FileCopy varOriginationMDB, varDestinationMDB

              or

              FileCopy varOriginationMDB, varDestinationLocation & “” & format(“yyyy-dd-mm”,Date()) & “.mdb”

              both should work

              Good luck

            • #518784

              Hi Drk,

              I tried it copying a specific table to another mdb. Try this bit of code:

              Sub CopyTable()
              Dim NewTableName As String
              Dim OldTableName As String
              Dim myDestinationDB As String

              myDestinationDB = “F:KenMAccessDevTestDB.mdb”
              NewTableName = “tblRecov_” & Now()
              OldTableName = “tblRecov_Bak”

              With Application
              .DoCmd.CopyObject , NewTableName, acTable, OldTableName
              .DoCmd.TransferDatabase acExport, “Microsoft Access”, myDestinationDB, acTable, NewtableName, NewtableName, 0, True
              .DoCmd.DeleteObject acTable, NewtableName
              End With
              End Sub

    Viewing 0 reply threads
    Reply To: Export Database as Time/Date

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: