We've been asked to look at boocking specific email addresses (because of recent UK legislation)
I've created a database of 'blocked' email addresses, and then put coding into the Memo form, SendTo field, Exiting event, which will prompt users if any of the names are on the 'blocked' database. I've pasted in the code below.
So far so good, it works fine BUT after a while it fails to function (debug shows that the Evaluate is returning nothing). I can only get it to work again by modifying the code a little and re-saving it.
Can anyone help me? I'm mystified as to why it fails.
Thanks in advance
Marcia
marcia70 at btinternet.com
Sub Exiting(Source As Field)
'now check the names in the SendTo against the Blocked list
Dim uiw As New notesuiworkspace
Dim uidoc As notesuidocument
Dim doc As notesdocument
Set uidoc = uiw.currentdocument
Set doc = uidoc.document
Dim item As Variant
Set item = doc.getfirstitem("SendTo")
Dim server As String
server = "our_server"
Dim temp As String
b=0 'mails blocked flag
Forall v In item.values
If Instr(v,"@") Then ' ie don't check internal names
doc.tmpfield=v 'set in the context of the doc for the dblookup
result=Evaluate({@dblookup("Notes":"NoCache"; server :"Blocked.nsf";"Main";tmpfield;"2")},doc)
If Isarray(result) Then
temp = temp & Chr$(10) & v
b=1 'set the blocked flag
End If
End If
End Forall
If (b>0) Then
'now set focus back to field
wqer= Messagebox("Recipient(s) " & temp & Chr$(10) &" on Blocked list", 0+16+0+0, "BLOCKED NAME(S) IN SEND TO FIELD:")
Call uidoc.gotofield("SendTo")
End If
End Sub

Temperamental coding - trying to bl... (Marcia Vigar 5.Jan.04)
. . 