Here are the code segments...
From the form that calls the procedure...
"frmSplash"
==================
option compare database
option explicit
==================
Private Sub Form_Load()
On Error Resume Next
'Popluate module level variables when form loads.
strVerClient = Nz(DLookup("[VersionNumber]", "[tblVersionClient]",
""))
strVerServer = Nz(DLookup("[VersionNumber]", "[tblVersionServer]",
""))
Me.lblClientVersion.Caption = "Disco Version: " & strVerClient
Me.Repaint
Me.TimerInterval = 1000
If IsUserInGroup("ADMINS", CurrentUser()) Then
If Month(Now()) = 1 And DAY(Now()) <= 14 Then
Me.lblArchive.Visible = True
End If
End Sub
=================
Private Sub Form_timer()
'Sub CheckVersion()
On Error Resume Next
Dim strMSG As String
Dim strPath As String
Dim strUpdateTool As String
Dim strWRKGRP As String
Const q As String * 1 = """"
'if versions match, then proceed with opening of main form.
If strVerClient = strVerServer Then
initProc
'if not, then offer the user the option to download the latest version
Else
strMSG = "You do not have the correct version." & vbCrLf & vbCrLf
& _
"Woul you like to download the latest client?"
If MsgBox(strMSG, vbExclamation + vbOKCancel, "Update") = vbOK
Then
strPath = "\\myserver\myprogrampath\Resources\update.mdb"
strWRKGRP = "\\myserver\myprogrampath\DiscoSecure.mdw"
strPath = q & strPath & q & " /WRKGRP " & q & strWRKGRP & q
strUpdateTool = "MSaccess.exe " & strPath
' ... then quit this client so it may be overwritten.
Shell strUpdateTool, vbNormalFocus
DoCmd.Quit
Else
'Don't load new version run current version
initProc
End If
End If
End Sub
==========
Sub initProc()
Me.TimerInterval = 0
Me.lblLoadingMenu.Visible = True
iniRead
Me.lblLoadingMenu.FontSize = 14
Me.lblLoadingMenu.FontWeight = 400
Me.lblLoadingMenu.Caption = "Loading Menus... Please Wait..."
Me.Repaint
DoCmd.OpenForm "frmSwitchboardLoader"
End Sub
======================================
This is the initRead and LinkTables code from same module...
==========
option compare database
option explicit
=========
Sub iniRead()
'read ini file to get initialization data
'call ini procedures to use data read
Dim strData As String
Dim f, ts, s, fs
Dim FoundAt As Integer
Dim iniFile As String
iniFile = CurrentProject.Path & "\Disco.ini"
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(iniFile) Then
Set f = fs.GetFile(iniFile)
Set ts = f.OpenAsTextStream(1, 0) 'open for reading, ascii
Do While Not ts.atendofstream
ReadLine:
s = ts.ReadLine
If Left(s, 1) = "'" Then
If ts.atendofstream Then
Exit Do
Else
GoTo ReadLine 'skip the rest of this loop and read the
next line this is a comment
End If
End If
'LinkTables
FoundAt = InStr(1, s, "DATASOURCE:")
If FoundAt > 0 Then
strData = Mid(s, FoundAt + 11)
LinkTables (strData)
End If
'Other ini stuff may be added later
Loop
ts.Close
End If
End Sub
=======================
Sub LinkTables(pPath As String)
'connects data to back end table and refreshes links
Dim tdfTable As TableDef
Forms!frmSplash.lblLoadingMenu.FontSize = 8
Forms!frmSplash.lblLoadingMenu.FontWeight = 700
For Each tdfTable In CurrentDb.TableDefs
If Len(tdfTable.Connect) > 1 Then
'inform the user which table is being connected
Forms!frmSplash.lblLoadingMenu.Caption = _
"Connecting to Disco Data on " & pPath & vbCrLf &
tdfTable.Name
Forms!frmSplash.Repaint
tdfTable.Connect = ";DATABASE=" & pPath
tdfTable.RefreshLink
End If
Next
End Sub
==================================
Problem described here...
When I am connected as myself (member of Admin group) all this code works
fine, links all tables, opens switchboard form when finished (switchboard
form closes the splash screen)
When I am connected as one of the users with limited access the splash
screen opens, the timer event fires and initProc is called, initRead is
called, LinkTables is called. Instead of looping through all of the
tabledefs
here For Each tdfTable In CurrentDb.TableDefs
...
it makes the first iteration then exits the loop.
Instead of returning to the initRead to return to initProc to return to
the timer event, it returns to the timer event and stops there. Now I
see why it's doing that because of an error it's getting and it's going
to resume next. I'm going to take out the resume next line and see if it
will tell me what the error is. I'll post back with the details if
necessary after I see what the error is.
TC said:
Show us the code that is causing Access to hang. (And show exactly
where in that code, you say it is hanging.)
TC