How to send msg to all logged users

  • Thread starter Thread starter Paul 3000.
  • Start date Start date
P

Paul 3000.

Hello gurus, MPVs and Access developers,

I would appreciate if anyone could give me a hint on how
to send a message through network to all users who is
logged in into database at the moment?
I.e. when there is a need to update FE MDE on users' PCs
I want to warn them.

Thank you
Paul.
 
Paul 3000. said:
Hello gurus, MPVs and Access developers,

I would appreciate if anyone could give me a hint on how
to send a message through network to all users who is
logged in into database at the moment?
I.e. when there is a need to update FE MDE on users' PCs
I want to warn them.

In most of the databases I build I have a Defaults table with all the
default values for that installation. The table is in the data back-end and
linked to the front end. I will often have a hidden form bound to that table
which passes any of the defaults to the current session of the application.
Things like the next PO number, etc. are in this table/form and they can be
referred to by the other applications. If you prefix the tablename with
"USys" (as in USysDefaults) the table will normally be hidden from view.

In this table you could easily add a boolean field (yes/no), lets call it
"Warn". Then bind it to a check box in the hidden form, and write some Timer
event code like this (air code):

Sub Form_Timer()
Me.Refresh

If Me.chkWarn = True Then
MsgBox "Closing in 5 minutes", vbOKOnly, "Database Maintenance"
Call WaitNSecs(300)
Application.Quit
End If

End Sub

Public Function WaitNSecs(Optional lngSecs As Long = 1)
Dim lngStart As Long
lngStart = Abs(86400 - Timer)

Do While Abs(lngStart - ((86400 - Timer))) < lngSecs
DoEvents
Loop

End Function

Set the Timer Interval to 60000 and the code will check once every minute.
Now when you want to close the database, change the value in USysDefaults
Warn to True and within 6 minutes everyone will be out of the database
except those who aren't there to see and close the msgbox. If you change the
msgbox to your own custom form, it won't matter if they are at their
computer or not.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top