Ilegal Use of Property - Warning -Long

Hi, folks. I have this in the sub opening a view and am attempting to assign someone’s name and a document lock onto the form. The reasoning behind this is to avoid people picking and choosing which piece of work in a queue that want to open.

Sub Postopen(Source As Notesuiview)

Dim session As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim Doc As NotesDocument

Set db = session.CurrentDatabase

Set view = db.GetView("HardCopy")

Set doc = view.GetFirstDocument

While Not doc Is Nothing

	If doc.EscFlag(0) <> "" Then

		Call doc.ReplaceItemValue _

		("RetrInit", session.UserName)

		Call doc.ReplaceItemValue_	("EscFlag", "")

		Call doc.Save(True, False)	

	End If

	Set doc = view.getnextdocument(doc)

Wend

End Sub

What am I missing? I also need to print the document in question prior to the save, and only continue the “wend” until one is found that does not already have a user name.

Any suggestions appreciated. I mostly use formulas and my scripting is sadly lacking. I turned on the debugger, of course, and know the error is happening on the line that says “Replace Item Value EscValue”. This is further complicated because depending on the type of work that it is, EscValue could have a value depending on whether someone worked on the document earlier. I empty the EscValue button with the following code on a button in a different view that receives the work first:

@If(!@IsNewDoc; @SetField(“AERDate”; @Today); @SetField(“AERDate”; “”));

@SetField(“EscFlag”; “”);

@Command([ToolsRunMacro]; “(UNLOCK)”);

@PostedCommand([EditDocument]; “1”);

@PostedCommand([FileSave]);

@PostedCommand([EditDocument]; “0”);

@PostedCommand([FileCloseWindow]).

The agent for UNLOCK (from this forum and thanks to whoever that was):

@SetField(“EscFlag” ; “”);

@SetField(“ProgressFlag”; “”);SELECT @all.

I had tried to do this with the forum suggestion for both the LOCK and UNLOCK agents run from the view through a button, but because of the workflow pattern thought I’d try to do this by script. Thanks for any suggestions and if you got this far, thanks very much for reading it. Best regards Cathy

Subject: RE: Ilegal Use of Property - Warning -Long

Call doc.ReplaceItemValue_ (“EscFlag”, “”)

There’s no method named ReplaceItemValue_ – the correct method name is ReplaceItemValue

Your macro agent is strange. I don’t understand why you’re calling a separate agent to set these fields. The agent will not run until after the other commands are processed. It’s not clear what this is supposed to accomplish.

Subject: RE: Ilegal Use of Property - Warning -Long

thanks for taking the time to read that, Andre. Maybe it’s just a typo - I’ll get rid of the underscore. And I did not know that the agent would not run. The agent is supposed to have already been run the last time a user was in the document to fill in the name of the user and the date the task was accomplished. When the view opens again, I was trying to set different fields (second user). I’ll just keep at it. Thanks for the feedback. Cathy

Subject: Ilegal Use of Property - FIXED

Andre, you were correct -it was the underscore after ReplaceItemValue that gave me the error message. You are also correct that my agents are NOT running properly … if I figure THAT part out, I’ll post again. In case you checked back, thanks again for your help. Regards, Cathy