MartyConnelly
martyconnelly at shaw.ca
Mon Jul 26 22:28:09 CDT 2004
But this odd command leads to something more interesting. You could use this saveastext 6,"","some.mdb" command to do regular unattended backups of your backend on some hourly basis. Even when the backend is in use. This seems to work, regardless of the state of the db, that is, tables can be open, but it copies them anyway, including data entered during the current open state, but it doesn't copy changed or new data in a dirty record. In your backend mdb you have this code You could put this in a module in your back-end data file and have it conditionally execute based on a what you pass it in the /cmd argument of the command line you use to open it. If Command = "Backup" Then BackTest End If Sub BackTemp() Dim a As New Access.Application Set a = New Access.Application With a .OpenCurrentDatabase "C:\Documents and Settings\Some User\My Documents\db2.mdb", False,True .SaveAsText 6, "", "C:\Documents and Settings\Some User\My Documents\db2Backup.mdb" .Quit acQuitSaveNone End With Set a = Nothing End Sub Then you'd open the back end with this command line: "C:\Program Files\Microsoft Office\Office\MSAccess.exe" "[data file path/name]" /cmd "Backup" You could have this command line executed on your server at a scheduled time. Of course, there could be problems there, as in some circumstances, applications with a UI won't run properly when invoked when there is no one logged into the server console. There is no real way to do this without opening the actual data file in the Access UI, because SaveAsText operates only on the MDB currently open in the Access user interface. Gustav Brock wrote: >Great Marty! > >But are you sure it will save everything? > >If I try acTable it won't - error 2487, object type is empty or >invalid for this method or action. > >/gustav > > > > >>hmm.. I never thought of attaching form code to a newsgroup message >>this way. >>It would show the design quite easily >> >> > > > >>However you might find this useful as it uses same method. >> >> > > > >> Here is the method to dump everything in an mdb to text files in temp >>directory via saveastext--loadfromtext method into a new mdb and then >>compile it. >> >> > > > -- Marty Connelly Victoria, B.C. Canada