John Colby
jcolby at colbyconsulting.com
Fri May 16 20:09:41 CDT 2003
OK, and a version that at least compiles: Function CopyDB() On Error GoTo cmdOK_Click_Err Dim DBNAME As String Dim x As Integer Dim DefaultWorkspace As Workspace Dim CurrentDatabase As Database Dim MyDatabase As Database Dim MyContainer As Container Dim MyDocument As Document Dim I As Integer Dim J As Integer Dim txtTable As String Set DefaultWorkspace = DBEngine.Workspaces(0) Set CurrentDatabase = DBEngine.Workspaces(0).Databases(0) Set MyDatabase = DefaultWorkspace.CreateDatabase("c:\bsupp\bsbackup.mdb", DB_LANG_GENERAL) MyDatabase.Close DoCmd.SetWarnings False 'txtCurrent = 0 For J = 0 To CurrentDatabase.Containers.Count - 1 Set MyContainer = CurrentDatabase.Containers(J) If MyContainer.Name = "Tables" Then 'txtTotal = MyContainer.Documents.Count For I = 0 To MyContainer.Documents.Count - 1 'txtCurrent = txtCurrent + 1 Set MyDocument = MyContainer.Documents(I) txtTable = MyDocument.Name If Left$(txtTable, 4) <> "Msys" And Left$(txtTable, 3) <> "qry" Then DoCmd.CopyObject "c:\bsupp\bsbackup.mdb", , A_TABLE, MyDocument.Name DoEvents End If Next I End If Next J cmdOK_Click_Exit: DoCmd.SetWarnings True DoCmd.Close Exit Function cmdOK_Click_Err: If err = 3204 Or err = 3151 Or err = 91 Then Resume Next MsgBox Error$ Resume Next End Function John W. Colby www.colbyconsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Michael R Mattys Sent: Friday, May 16, 2003 8:46 PM To: accessd at databaseadvisors.com Subject: Re: [AccessD] BE, Back Up Question Copying an Open Mdb! John Lawson, Dundee City Council of UK. The script is designed as an on-click event procedure for a command button. The script was developed using Microsoft Access V2.0 Sub cmdOK_Click () On Error GoTo cmdOK_Click_Err Dim DBNAME As String Dim x As Integer Dim DefaultWorkspace As WorkSpace Dim CurrentDatabase As Database, MyDatabase As Database Dim MyContainer As Container, MyDocument As Document Dim I As Integer, J As Integer Set DefaultWorkspace = DBEngine.Workspaces(0) Set CurrentDatabase = DBEngine.Workspaces(0).Databases(0) Set MyDatabase = DefaultWorkspace.CreateDatabase("c:\bsupp\bsbackup.mdb", DB_LANG_GENERAL) MyDatabase.Close DoCmd SetWarnings False txtCurrent = 0 For J = 0 To CurrentDatabase.Containers.count - 1 Set MyContainer = CurrentDatabase.Containers(J) If MyContainer.Name = "Tables" Then txtTotal = MyContainer.Documents.count For I = 0 To MyContainer.Documents.count - 1 txtCurrent = txtCurrent + 1 Set MyDocument = MyContainer.Documents(I) txtTable = MyDocument.Name If Left$(txtTable, 4) <> "Msys" And Left$(txtTable, 3) <> "qry" Then DoCmd CopyObject "c:\bsupp\bsbackup.mdb", , A_TABLE, MyDocument.Name DoEvents End If Next I End If Next J cmdOK_Click_Exit: DoCmd SetWarnings True DoCmd Close Exit Sub cmdOK_Click_Err: If Err = 3204 Or Err = 3151 Or Err = 91 Then Resume Next MsgBox Error$ Resume Next End Sub I think I got this from JC's siteMichael R. Mattys www.mattysconsulting.com ----- Original Message ----- From: "Robert Gracie" <Subscriptions at servicexp.com> To: "Access D" <AccessD at databaseadvisors.com> Sent: Friday, May 16, 2003 8:32 PM Subject: [AccessD] BE, Back Up Question > I have been reading of more and more Access BE's corrupting beyond recovery, > and Am getting a little concerned. > > I'm working with a mammoth Access DB, (FE/BE Split) it's a full Business > Management System which has around 214 tables in the BE, with a 22Meg Front > End. It's been running Ok for about a year, but with a db this complex, I > need to find a way to back-Up the BE db every 30 to 60 minutes while users > are still in working. > > How might one go about doing this safely? The BE resides on a Pier-to-Pier > network with the "server" running Win2K. > > > Thanks > Robert Gracie > > > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com