I have 3 dbs, forms, data and password. I have password protected data and password but now cannot open the databases.
I link the tables dynamically.
My code is
what I now need is how to add the password ...
I have seen many examples and have tried most (incl. connectstrings) but cannot make it work.Any help greatfully appreciated.
I link the tables dynamically.
My code is
Code:
datapathextra = "_data"
mydot = InStr(1, datapath, ".")
workpath = Left(datapath, mydot - 1)
worklen = Len(datapath)
workpath = workpath + datapathextra
workpath = workpath + Right(datapath, worklen - (mydot - 1))
Set db = OpenDatabase(datapath)
db.TableDefs.Refresh
table_count = db.TableDefs.Count
For i = 0 To db.TableDefs.Count - 1
If Left(db.TableDefs(i).Name, 4) <> "Msys" Then
'check if name exists
name_exists = False
j = 0
For j = 0 To mytablecount - 1
If db.TableDefs(i).Name = MyTables(j) Then
name_exists = True
End If
Next j
If name_exists = False Then
dbsource = db.TableDefs(i).Name
DoCmd.TransferDatabase acLink, "Microsoft Access", datapath, acTable, dbsource, dbsource
End If
End If
Next i
Set db = Nothing
I have seen many examples and have tried most (incl. connectstrings) but cannot make it work.Any help greatfully appreciated.