I have an access 2003 front end back end setup used by 4-5 users.
Each user has a front end on their desktop and the back end resides in the commany's shared drive with a folder dedicated to the back end.
My problem is that if more than 1 user is using the dtabase, the forms can take more than 10 sec to load, and if on a VPN, more than 30 secs.
I am going through the top 100 performance top listed on teh FMS site however I need help to have a persistent connection. I have looked into this briefly with thread705-1522474 and found the following code again on the FMS site.
In order to implement this (and this is the question), I have to :
1- Insert a new module
2- Amend the code below with the location of the back end
3- Save the module as 'PersistentDB'
How do I 'call' this module from my opening form? Can I just enter OpenAllDatabases True?
Thanks
Sub OpenAllDatabases(pfInit As Boolean)
' Open a handle to all databases and keep it open _
' during the entire time the application runs.
' In: pfInit TRUE to initialize
' (call when application starts)
' FALSE to close
' (call when application ends)
' Created : FMS, Inc.
Dim x As Integer
Dim strName As String
Dim strMsg As String
' Maximum number of back end databases to link
Const cintMaxDatabases As Integer = 2
' List of databases kept in a static array
' so we can close them later
Static dbsOpen() As DAO.Database
If pfInit Then
ReDim dbsOpen(1 To cintMaxDatabases)
For x = 1 To cintMaxDatabases
' Specify your back end databases
Select Case x
Case 1:
strName = "H:\Dir\Backend1.mdb"
Case 2:
strName = "H:\Dir\Backend2.mdb"
End Select
strMsg = ""
On Error Resume Next
Set dbsOpen(x) = OpenDatabase(strName)
If Err.Number > 0 Then
strMsg = "Trouble opening database: " & strName & _
vbCrLf & _
"Make sure the drive is available." & _
vbCrLf & _
"Error: " & Err.Description & _
" (" & Err.Number & ")"
End If
On Error GoTo 0
If strMsg <> "" Then
MsgBox strMsg
Exit For
End If
Next x
Else
On Error Resume Next
For x = 1 To cintMaxDatabases
dbsOpen(x).Close
Next x
End If
End Sub
If I did not say it before, I really appreciate the time and expertise of the users on this forum.
Each user has a front end on their desktop and the back end resides in the commany's shared drive with a folder dedicated to the back end.
My problem is that if more than 1 user is using the dtabase, the forms can take more than 10 sec to load, and if on a VPN, more than 30 secs.
I am going through the top 100 performance top listed on teh FMS site however I need help to have a persistent connection. I have looked into this briefly with thread705-1522474 and found the following code again on the FMS site.
In order to implement this (and this is the question), I have to :
1- Insert a new module
2- Amend the code below with the location of the back end
3- Save the module as 'PersistentDB'
How do I 'call' this module from my opening form? Can I just enter OpenAllDatabases True?
Thanks
Sub OpenAllDatabases(pfInit As Boolean)
' Open a handle to all databases and keep it open _
' during the entire time the application runs.
' In: pfInit TRUE to initialize
' (call when application starts)
' FALSE to close
' (call when application ends)
' Created : FMS, Inc.
Dim x As Integer
Dim strName As String
Dim strMsg As String
' Maximum number of back end databases to link
Const cintMaxDatabases As Integer = 2
' List of databases kept in a static array
' so we can close them later
Static dbsOpen() As DAO.Database
If pfInit Then
ReDim dbsOpen(1 To cintMaxDatabases)
For x = 1 To cintMaxDatabases
' Specify your back end databases
Select Case x
Case 1:
strName = "H:\Dir\Backend1.mdb"
Case 2:
strName = "H:\Dir\Backend2.mdb"
End Select
strMsg = ""
On Error Resume Next
Set dbsOpen(x) = OpenDatabase(strName)
If Err.Number > 0 Then
strMsg = "Trouble opening database: " & strName & _
vbCrLf & _
"Make sure the drive is available." & _
vbCrLf & _
"Error: " & Err.Description & _
" (" & Err.Number & ")"
End If
On Error GoTo 0
If strMsg <> "" Then
MsgBox strMsg
Exit For
End If
Next x
Else
On Error Resume Next
For x = 1 To cintMaxDatabases
dbsOpen(x).Close
Next x
End If
End Sub
If I did not say it before, I really appreciate the time and expertise of the users on this forum.