Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lotus Script Problem - Queryopen event

Status
Not open for further replies.

daveinuk

Technical User
Sep 2, 2005
72
DE
Hi all, in my memo form in the queryopen event i already have the following script:

Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
Set cMemoObject = New UIMemoDocument
Call cMemoObject.Init(Source,Isnewdoc)
End Sub



However I want to also add another bit of code in that lets me know that someone has put a read reciept on the email and gives my the option to delete the read receipt. However when I try and copy and paste it into the queryopen event it all goes wrong! Here is the read receipt code:

Sub Queryopen(Source As Notesuidocument,
Mode As Integer, Isnewdoc As Variant,
Continue As Variant)
Set uidoc = Source
Set doc = Source.document
Dim workspace As NotesUIWorkspace
Dim RR As Variant
Dim boxType As Long, answer As Integer
If uidoc.IsNewDoc Then
' don't do anything, as this is a new document ...
Else
RR = doc.GetItemValue("ReturnReceipt")
If RR(0) = "1" Then
boxType& = MB_YESNO
answer% = Messagebox("Message configured for Return Reciept. Would you like to send a Return Receipt? (No will temporarily disable Return Receipt)", boxType&, "Continue?" )
If answer% = 7 Then
' determine if the user would like to return the receipt
doc.ReturnReceipt = "0"
Messagebox("Return Reciept disabled. No message will be sent")
'Call doc.save (True, True) enable this if you want to totally disable RR on this message
End If
End If
End If
End Sub

Can anyone tell me how to combine the two so that they will work?

thanks.

David.
 
I don't see where the issue is. I just mashed the two together and tested and it works fine.

Of course, I like to rearrange my code a bit, so this is what I actually used :
Code:
Dim workspace As NotesUIWorkspace
	Dim RR As Variant
	Dim boxType As Long, answer As Integer
	
	Set uidoc = Source
	Set doc = Source.document
	Set cMemoObject = New UIMemoDocument         
	Call cMemoObject.Init(Source,Isnewdoc)
	
	If uidoc.IsNewDoc Then
' don't do anything, as this is a new document ...
	Else
		RR = doc.GetItemValue("ReturnReceipt")
		If RR(0) = "1" Then
			boxType& = MB_YESNO
			answer% = Messagebox("Message configured for Return Reciept. Would you like to send a Return Receipt? (No will temporarily disable Return Receipt)", boxType&, "Continue?" )
			If answer% = 7 Then
' determine if the user would like to return the receipt
				doc.ReturnReceipt = "0"
				Messagebox("Return Reciept disabled. No message will be sent")
'Call doc.save (True, True) enable this if you want to totally disable RR on this message
			End If
		End If
	End If

Pascal.
 
hi, its daveinuk but there is a problem with my login so I need to use this one. When I try to copy and paste your lotus script into my queryopen event it seems to cut off the bit at the top before the setuidoc = source, and it puts the top bit of code into the 'declarations' event. Any ideas?
 
ok right well I have managed to get the code to go in, only by putting it in this way:-

Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
Set cMemoObject = New UIMemoDocument
Call cMemoObject.Init(Source,Isnewdoc)
If uidoc.IsNewDoc Then
' don't do anything, as this is a new document ...
Else
RR = doc.GetItemValue("ReturnReceipt")
If RR(0) = "1" Then
boxType& = MB_YESNO
answer% = Messagebox("Message configured for Return Reciept. Would you like to send a Return Receipt? (No will temporarily disable Return Receipt)", boxType&, "Continue?" )
If answer% = 7 Then
' determine if the user would like to return the receipt
doc.ReturnReceipt = "0"
Messagebox("Return Reciept disabled. No message will be sent")
'Call doc.save (True, True) enable this if you want to totally disable RR on this message
End If
End If
End If
End Sub

However every time I go into a new email it tells me 'variant does not contain an object'...and more ideas?
 
Code goes into the Declarations section ? Did you paste it in between the Sub QueryOpen... statement ?

Also, which version of Notes are you using ?

The code I pasted works fine in R6.52.

Pascal.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top