/ Forums / Advansys Formativ / Creating Solutions with Formativ / Access violation / Reply To: Access violation
Having altered my coding a little I now have …
Set oAcct = Client.ClientState.CurrentAccount
On Error Resume Next
Set oMsg = Client.ClientState.CommandMessage
On Error Goto 0
If Not IsObject(oMsg) Then
‘Check to see if the message is actually in a shared folder owned by someone else
‘If not then …
If Client.ClientState.SelectedFolder.Owner.DisplayName = oAcct.Owner.DisplayName Then
On Error Resume Next
Set oMsg = oAcct.GetMessage(Groupwise.ItemMessageIDFromView())
On Error Goto 0
‘If so, get the message from the folder itself
Else
On Error Resume Next
Set oMsg = Client.ClientState.SelectedFolder.Messages(Groupwise.ItemMessageIDFromView())
On Error Goto 0
End If
End If
If IsObject(oMsg) Then
MsgBox “S4”
< code inside loop goes here >
End If
—
I can’t do anything about the ‘memory leak’ so am just trying to get msgbox S4 to fire.
If the chosen email is in a Shared folder I don’t own then I would expect my oAcct.GetMessage to fail since the message isn’t strictly speaking in my mailbox anymore.
What I am doing above is testing ownership of the folder and reacting accordingly.
Not shared means use GetMessage, shared means get the message from the folder itself.
However, although this makes S4 appear OK any attempted use of the oMsg variable then causes a ‘standard’ Formativ error of “Object required: ‘oMsg’ at line 38, column 6”
Line 38 is the next line to use oMsg after the IsObject(oMsg) test.
Further investigation tells me that the line
Set oMsg = Client.ClientState.SelectedFolder.Messages(Groupwise.ItemMessageIDFromView())
is failing in a weird way. The Groupwise.ItemMessageIDFromView() part errors, creating a ‘token execution failed’ message but the oMsg object is at least partially created to pass the IsObject test?
The Groupwise.ItemMessageIDFromView() call works fine when the message is in my mailbox and I’ve used this same technique in another applet and it worked fine so I don’t get how it’s going wrong here.
How do I get the message if I can’t tell which message has been opened?
This problem is affecting several PCs, not just my Creator one. The applet is meant to test an opened email to see if the user has an action against them but currently it doesn’t get that far.
Thanks
Simon