transferdatabase method problems 
Author Message
 transferdatabase method problems

I try to make a backup of my mdb file at the end of a worksession.
I use a docmd.transferdatabase command in it but I always get an error
message.
I tried the same in Access 97 (first as a macro, afterwards as a module)
and it works fine.
For the ones who would like to test :

Function BackupDataBase(filename$) As Integer
    On Error GoTo BackupDataBase_Err

    Dim newDB As Database, oldDB As Database
    Dim tempname As String, path As String, numTables As Integer
    Dim intIndex As Integer
    Dim errorFlag As Integer

    path = GetApplicationDir() & filename$

    If MB_FileExists(path) Then
        Kill path
    End If

        Set newDB = DBEngine.Workspaces(0).CreateDatabase(path,
dbLangGeneral)
        newDB.Close
    Set oldDB = DBEngine.Workspaces(0).OpenDatabase(gDbPathName &
"name.MDB")
    numTables = oldDB.TableDefs.Count - 1
        For intIndex = 0 To numTables
            tempname = oldDB.TableDefs(intIndex).Name
            If ValidTableFilter(tempname) Then
                DoCmd.TransferDatabase acExport, "Microsoft Access", path,
acTable, tempname, tempname, False
            End If
        Next intIndex

                    BackupDataBase = True
BackupDataBase_Exit:

                    If errorFlag Then
                        BackupDataBase = False

                        If MB_FileExists(path) Then
                            Kill path
                            MsgBox " error and killed"
                        End If

                        Else
                            BackupDataBase = True
                        End If

                            Exit Function
BackupDataBase_Err:

                            MsgBox "Backup Failed! Error: " & Error$, 48,
"FUNCTION: BackupDataBase( " & filename$ & " )"
                            errorFlag = True
                            Resume BackupDataBase_Exit
                        End Function

I hope someone can tell me what's going wrong !



Sat, 04 Aug 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. TransferDatabase Method Problem

2. problem with TransferDatabase method

3. TransferDatabase method with Linked table Problem

4. transferdatabase method using dsn-less connection

5. Access 97 TransferDatabase method to import queried SQL 2000 data

6. TransferDatabase method

7. TransferDatabase method question

8. TransferDatabase method using password

9. Access97: IPF with TransferDatabase method

10. TransferDatabase Method Error

11. Having trouble with the TransferDatabase method

12. TransferDatabase method

 

 
Powered by phpBB® Forum Software