M
Markus
Hallo
I would like to relink my Front end DB with a Backend DB that password
protected
This is the code i am using at the moment but its missing the part for the
password.
On Error GoTo Startup_Err
Dim tdf As DAO.TableDef
Dim strD As String
Dim strC As String
Dim strMM As String
Dim strFilename As String
Dim strIMEX As String
Dim db As DAO.Database
Set db = CurrentDb
strD = "\\cmms acr log\tables\"
DoCmd.OpenForm "frmLinkingTables"
For Each tdf In CurrentDb.TableDefs
If Len(Nz(tdf.Connect, "")) > 0 Then ' non-local
If Right(tdf.Connect, 3) = "dat" Then
If InStr(tdf.Connect, strD) = 0 Then ' need to
reconnect
Forms!frmLinkingTables!lblTable.Caption = tdf.Name
strIMEX = Left(tdf.Connect, InStr(tdf.Connect,
"Database=") + 8)
strC = strIMEX & strD & "tables.dat"
tdf.Connect = strC
tdf.RefreshLink
DoEvents
End If
Else
strFilename = getfile(Mid(tdf.Connect, 11))
If InStr(tdf.Connect, strD) = 0 Then ' need to
reconnect
Forms!frmLinkingTables!lblTable.Caption = tdf.Name
tdf.Connect = (";DATABASE=" & strD & strFilename)
tdf.RefreshLink
End If
End If
End If
Next
DoCmd.Close acForm, "frmLinkingTables"
Startup_Exit:
Exit Sub
Startup_Err:
If Err.Number = 2450 Then 'form is missing
MsgBox "Cancelling Linking"
Resume Startup_Exit
Else
MsgBox Err.Description
Resume Startup_Exit
End If
End Sub
I would like to relink my Front end DB with a Backend DB that password
protected
This is the code i am using at the moment but its missing the part for the
password.
On Error GoTo Startup_Err
Dim tdf As DAO.TableDef
Dim strD As String
Dim strC As String
Dim strMM As String
Dim strFilename As String
Dim strIMEX As String
Dim db As DAO.Database
Set db = CurrentDb
strD = "\\cmms acr log\tables\"
DoCmd.OpenForm "frmLinkingTables"
For Each tdf In CurrentDb.TableDefs
If Len(Nz(tdf.Connect, "")) > 0 Then ' non-local
If Right(tdf.Connect, 3) = "dat" Then
If InStr(tdf.Connect, strD) = 0 Then ' need to
reconnect
Forms!frmLinkingTables!lblTable.Caption = tdf.Name
strIMEX = Left(tdf.Connect, InStr(tdf.Connect,
"Database=") + 8)
strC = strIMEX & strD & "tables.dat"
tdf.Connect = strC
tdf.RefreshLink
DoEvents
End If
Else
strFilename = getfile(Mid(tdf.Connect, 11))
If InStr(tdf.Connect, strD) = 0 Then ' need to
reconnect
Forms!frmLinkingTables!lblTable.Caption = tdf.Name
tdf.Connect = (";DATABASE=" & strD & strFilename)
tdf.RefreshLink
End If
End If
End If
Next
DoCmd.Close acForm, "frmLinkingTables"
Startup_Exit:
Exit Sub
Startup_Err:
If Err.Number = 2450 Then 'form is missing
MsgBox "Cancelling Linking"
Resume Startup_Exit
Else
MsgBox Err.Description
Resume Startup_Exit
End If
End Sub