G
Glint
Hi All,
Please help me out on this one. I want a user of my form to be aware of a
new message from another user as soon as it sent to the messages table. I
have tried all I could until I settled for the On Activate property of the
switchboard form. The code seems to work as I wanted except that it appears
to run everything twice: thus, the msgbox in the code is displayed twice,
somewhat annoyingly. I don't know how else to make things work better.
Private Sub Form_Activate()
On Error GoTo Err_Form_Activate
If IsLoaded("Open Sesame") Then
If DCount("*", "MessagesTable", "[Seen]=" & 1 & " And
[Destination]=" & DLookup("User", "qLoggedInUser")) > 0 Then
Mail.Visible = True
Me.TimerInterval = 500
DoCmd.OpenForm "SendMessages2", , , "[Destination]=" &
DLookup("User", "qLoggedInUser")
MsgBox "Sorry to interrupt you," & vbCrLf & _
"but you 've got a message.", vbInformation, "ECKANKAR AREA ADMIN"
Else
Mail.Visible = False
Me.TimerInterval = 0
Mail.BackColor = vbWhite
End If
End If
Exit_Form_Activate:
Exit Sub
Err_Form_Activate:
MsgBox Err.Description
Resume Exit_Form_Activate
End Sub
The code is expected to run whenever the user gets back to the switchboard
as he would do soon in normal usage. I did not have a better idea to achieve
the same purpose, so I tried the On Activate property, until this thing about
doing everything twice.
Please help.
Please help me out on this one. I want a user of my form to be aware of a
new message from another user as soon as it sent to the messages table. I
have tried all I could until I settled for the On Activate property of the
switchboard form. The code seems to work as I wanted except that it appears
to run everything twice: thus, the msgbox in the code is displayed twice,
somewhat annoyingly. I don't know how else to make things work better.
Private Sub Form_Activate()
On Error GoTo Err_Form_Activate
If IsLoaded("Open Sesame") Then
If DCount("*", "MessagesTable", "[Seen]=" & 1 & " And
[Destination]=" & DLookup("User", "qLoggedInUser")) > 0 Then
Mail.Visible = True
Me.TimerInterval = 500
DoCmd.OpenForm "SendMessages2", , , "[Destination]=" &
DLookup("User", "qLoggedInUser")
MsgBox "Sorry to interrupt you," & vbCrLf & _
"but you 've got a message.", vbInformation, "ECKANKAR AREA ADMIN"
Else
Mail.Visible = False
Me.TimerInterval = 0
Mail.BackColor = vbWhite
End If
End If
Exit_Form_Activate:
Exit Sub
Err_Form_Activate:
MsgBox Err.Description
Resume Exit_Form_Activate
End Sub
The code is expected to run whenever the user gets back to the switchboard
as he would do soon in normal usage. I did not have a better idea to achieve
the same purpose, so I tried the On Activate property, until this thing about
doing everything twice.
Please help.