I cannot concatenate properly the line
Set BackDB = OpenDatabase(DBName,pwd=" & StrPassword)
which is wrong and gives me errors.Can you help ?
Public Function ImportAllTables(DBName, strPassword As String)
strPassword = " pin"
Dim FrontDB As DAO.Database, BackDB As DAO.Database, Tbl As TableDef
Set FrontDB = CurrentDb
Set BackDB = OpenDatabase(DBName,pwd=" & StrPassword)
For Each Tbl In BackDB.TableDefs
If Tbl.Attributes = 0 Then
DoCmd.TransferDatabase acImport, "Microsoft Access", BackDB.Name, acTable, Tbl.Name, Tbl.Name
End If
Next
BackDB.Close
FrontDB.Close
End Function
Set BackDB = OpenDatabase(DBName,pwd=" & StrPassword)
which is wrong and gives me errors.Can you help ?
Public Function ImportAllTables(DBName, strPassword As String)
strPassword = " pin"
Dim FrontDB As DAO.Database, BackDB As DAO.Database, Tbl As TableDef
Set FrontDB = CurrentDb
Set BackDB = OpenDatabase(DBName,pwd=" & StrPassword)
For Each Tbl In BackDB.TableDefs
If Tbl.Attributes = 0 Then
DoCmd.TransferDatabase acImport, "Microsoft Access", BackDB.Name, acTable, Tbl.Name, Tbl.Name
End If
Next
BackDB.Close
FrontDB.Close
End Function