I use the following code (behind a command button on the FE) to relink
from a user's local copy of the BE to the file-server's BE on our LAN.
I use this, for example, when a person brings in their laptop and
connects to our LAN.
The code works fine if there are no other users accessing the server's
BE at the time. If the file-server's BE is open at the time, however,
then the relinking process does not finish -- it just pauses. When
everyone else closes out of the database, then the process continues on
its own and the laptop's FE is now linked to the server's BE.
Our multi-user, split database setup works fine normally --
simultaneous users can open and close out of the database without a
problem -- as long as their FEs are already linked to the server's BE.
One other factor: The FEs have a hidden form, always open, and which is
based on a utility table in the BE.
Question:
Is there anything I can do which will allow computers on our LAN to
relink from a local BE to the server's BE without having everyone else
close out of the database?
Thanks for any help.
Mark
Dim dbs As Database
Dim tdf As TableDef
Dim Tdfs As TableDefs
Dim NewPathname As String
Set dbs = CurrentDb
Set Tdfs = dbs.TableDefs
'************** **Link to Network Drive-P
If Len(Dir("P:\fps data.mdb")) = 0 Then
MsgBox "You're not connected to the network."
Resume exithandler
End If
NewPathname = "P:\fpsdata.mdb "
'Loop through the tables collection
For Each tdf In Tdfs
On Error GoTo errhandler
'...link main tables
If Len(tdf.Connect ) > 0 Then
tdf.Connect = ";DATABASE= " & NewPathname
tdf.RefreshLink
End If
Next 'Goto next table
from a user's local copy of the BE to the file-server's BE on our LAN.
I use this, for example, when a person brings in their laptop and
connects to our LAN.
The code works fine if there are no other users accessing the server's
BE at the time. If the file-server's BE is open at the time, however,
then the relinking process does not finish -- it just pauses. When
everyone else closes out of the database, then the process continues on
its own and the laptop's FE is now linked to the server's BE.
Our multi-user, split database setup works fine normally --
simultaneous users can open and close out of the database without a
problem -- as long as their FEs are already linked to the server's BE.
One other factor: The FEs have a hidden form, always open, and which is
based on a utility table in the BE.
Question:
Is there anything I can do which will allow computers on our LAN to
relink from a local BE to the server's BE without having everyone else
close out of the database?
Thanks for any help.
Mark
Dim dbs As Database
Dim tdf As TableDef
Dim Tdfs As TableDefs
Dim NewPathname As String
Set dbs = CurrentDb
Set Tdfs = dbs.TableDefs
'************** **Link to Network Drive-P
If Len(Dir("P:\fps data.mdb")) = 0 Then
MsgBox "You're not connected to the network."
Resume exithandler
End If
NewPathname = "P:\fpsdata.mdb "
'Loop through the tables collection
For Each tdf In Tdfs
On Error GoTo errhandler
'...link main tables
If Len(tdf.Connect ) > 0 Then
tdf.Connect = ";DATABASE= " & NewPathname
tdf.RefreshLink
End If
Next 'Goto next table
Comment