G
Glint
Hi Guys,
I am sorry to re-post this problem I have but I have not been able to find
an explanation. It is this: I want a user to be aware that a message has
arrived for him whenever he gets to the switchboard and then take him
directly to the message by opening the appropriate form.
The problem I have is that the code appears to execute more than one time as
the msgbox in the code pops up twice or more. The code I used on the Activate
Event of the switchboard form is below:
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
I have tried using the Current Event to trigger the same code but the
program hanged on an unrecognized error. The GotFocus event did not help
either as the code was not executed at all. Please help.
I am sorry to re-post this problem I have but I have not been able to find
an explanation. It is this: I want a user to be aware that a message has
arrived for him whenever he gets to the switchboard and then take him
directly to the message by opening the appropriate form.
The problem I have is that the code appears to execute more than one time as
the msgbox in the code pops up twice or more. The code I used on the Activate
Event of the switchboard form is below:
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
I have tried using the Current Event to trigger the same code but the
program hanged on an unrecognized error. The GotFocus event did not help
either as the code was not executed at all. Please help.