Beverly76 said:
Is there a way to open in Exclusive mode, and if there are other users in
at
that time, kick them out and proceed to open in exclusive mode.
Yes but you'll have to code it, there's not built-in facility. Below is the
code I use, it's attached to the main form's Timer event with the timer
interval set to 30000. It enables you to target all users, a specific user
or a specific computer so you'll need a table/query with fields "Type" and
"Value" to contain a time, a username or a computer name respectively.
You'll also need a shutdown form that warns the user of the impending
shutdown. "fOSUserName()" is a function that returns the user's network
logon ID. So typically, your table might contain:
Type: Time
Value: 10:30
So that will kick all users out and keep them out at and after that time.
Hope it helps.
Keith.
www.keithwilby.com
On Error Resume Next
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim dtmTimeOut As Date
Dim varType As Variant
Dim varValue As Variant
Set db = CurrentDb()
Set rs = db.OpenRecordset("qtblShutdown")
Do While Not rs.EOF
varValue = rs!Value
If Not IsNull(varValue) Then
Select Case rs!Type
Case "User"
If varValue = fOSUserName() Then
DoCmd.OpenForm "fdlgShutdown", , , , , acDialog
mfTimedOut = True
DoCmd.Close acForm, Me.Name
End If
Case "Computer":
If varValue = fOSMachineName Then
DoCmd.OpenForm "fdlgShutdown", , , , , acDialog
mfTimedOut = True
DoCmd.Close acForm, Me.Name
End If
Case "Time"
dtmTimeOut = varValue
If mdtmTime < dtmTimeOut And Time > dtmTimeOut Then
DoCmd.OpenForm "fdlgShutdown", , , , , acDialog
mfTimedOut = True
DoCmd.Close acForm, Me.Name
End If
End Select
End If
rs.MoveNext
Loop