| Baby Face Lee 2005-11-04, 11:44 am |
| Hi everyone
I have a database that around 4 folk may be using simultaneously. A few
times now, one of the staff has reported that when she comes out of the app
and then goes back in:
a) a further instance of Access is still remaining in Task Manager
b) some of the records keyed immediately prior to exiting have disappeared
I use a small bit of code to automatically link the front end that's on each
user's PC to the back-end tables that are on a server. Here's what it says:
Public Function RefreshLinks(strFile
Name As String) As Boolean
' Refresh links to the supplied database. Return True if successful.
Dim dbs As Database
Dim tdf As TableDef
' Loop through all tables in the database.
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
' If the table has a connect string, it's a linked table.
If Len(tdf.Connect) > 0 Then
tdf.Connect = ";DATABASE=" & strFileName
Err = 0
On Error Resume Next
tdf.RefreshLink ' Relink the table.
If Err <> 0 Then
RefreshLinks = False
MsgBox "Failed to link to the tables." _
& vbCrLf & vbCrLf & "Please inform the database
administrator", vbCritical, "Error"
Exit Function
End If
End If
Next tdf
RefreshLinks = True ' Relinking complete.
End Function
The function is called from a form that opens during startup which has this
code:
Private Sub Form_Open(Cancel As Integer)
' As this form is opened when the database starts, check if the backend
tables can be located.
Dim strFileName As String
strFileName = "...path to the server..."
Call RefreshLinks(strFile
Name)
DoCmd.OpenForm "frm_Menu"
Cancel = True
End Sub
Could the above be the problem perhaps? Any ideas?
Thanks in advance,
Lee
|