OTWarrior via AccessMonster.com said:
the database has a logout proceedure, which unfortunately one person often
forgets to log out at the end of the day, so he doesn't get the updates.
He
often stays late, so I have written some code to prompt him with a
messagebox
when it is after 5:30 to logout.
However, I also want a sound file to play when this messagebox loads,
which i
have the code to do.
What I really want to know is can you unmute the sound on a computer and
set
the sound level (so it is not too loud, but enough to get his attention)?
or
does this border on hacking?
Here's some code you can use to set a time for the app to close
automatically. You'll need a table "tblShutdown" with fields "Value" and
"Type" and a query "qtblShutdown" based on it. The code goes into the timer
event of a hidden form or a form that's always loaded. I have the timer
interval set to 30 seconds.
You can use it to target certain users and computers or to set a time for
shutdown to occur. To get the app to shutdown at 17:30, put that time in
the "Value" field and put "time" into the "Type" field. "fdlgShutdown" is
the form that appears to warn the user(s) that a forced shutdown is
occurring. You also need to call the code when your app opens so that new
users are kept out. This isn't the full solution but you should be able to
work out what other bits are needed.
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
End If