I have a database that we use to log caller information. Throughout the day,
we need to communicate to our associates taking calls. Is there anywayto
send an alert through our current access database? Something like a pop up
box. Thanks!
A form has a Timer Interval property. The form can respond to an On
Timer event.
In a form that never closes during the run of the program, create the
following declarations, functions and subroutines:
Private Declare Function GetUserName Lib "advapi32.dll" Alias
"GetUserNameA" _
(ByVal szUserName As String, cbMaxLen As
Long) As Long
Public Function vbGetUserName()
Dim cbMaxLen As Long
Dim sUserName As String * 16
Dim cbRetCode As Long
cbMaxLen = 16
cbRetCode = GetUserName(sUserName, cbMaxLen)
cbMaxLen = cbMaxLen - 1
vbGetUserName = Left(sUserName, cbMaxLen)
End Function
Private Sub Form_Load()
Me.timerinterval = 30000 ' The Form_Timer event will fire every 30
seconds
end sub
Private Sub Form_Timer()
Dim stDocName as string
Dim stLinkCriteria as string
Dim sUserName as string
Dim nCount as integer
Dim sWhereClause as string
sDocName = "frmMyPopUp"
sUserName = vbGetUserName()
sWhereClause = "[Addressee] = '" & sUserName & "'"
nCount = DCount( "*", "tblUserMessages", sWhereClause )
if nCount > 0 then
stLinkCriteria = sWhereClause
DoCmd.OpenForm stDocName, , , stLinkCriteria ' Only display
messages for the current user
end if
end sub
Then create a form named frmMyPopUp. Its Record Source is
"tblUserMessages".
The form's OnClose event must delete the displayed row from
"tblUserMessages".
We could get a lot more sophisticated, but this will get you started.