@command and other ui functions are not allowed in this context

hello all:any body knows what this error means I am using

call uidoc.close and

call uidoc.save

I searched but seems that I am the only one who had this error

any ideas

thanks

Dalia

Subject: @command and other ui functions are not allowed in this context

Not much to go on but - I’d check you QuerySave and QueryClose for @Commands. You may be using one that can’t be used in these events.

Subject: RE: @command and other ui functions are not allowed in this context

thanks Glenbut I checked my problem is that I cannot use

call uidoc.save

although I need to save the document

and when I am using

call doc.save(true,true)

the document is not saved and does not appear in views

is this a new r6 problem or feature

thanks

Dalia

Subject: RE: @command and other ui functions are not allowed in this context

the problem is probably where your trying to use this code?

Where is this code? button on form?/agent?/?

Subject: RE: @command and other ui functions are not allowed in this context

this code is in an action in a form ,I tried using a button but same error

thank you for cooperation

thanks

dalia

Subject: RE: @command and other ui functions are not allowed in this context

make sure you’re doing the close after the save

make sure that if your saving the document it is in edit mode - the editMode property of uidoc will tell you this

e.g.

If uidoc.editmode Then

  Call uidoc.save          

End If

Call uidoc.close

Subject: RE: @command and other ui functions are not allowed in this context

I tried exactly what you said ,I got the error @command and other ui functions are not allowed in this context

in the call uidoc.save line

do you have any ideas about this error in the uidoc

thanks a million Glen

Subject: RE: @command and other ui functions are not allowed in this context

what other code comes before the save and close? - may be a problem their.

How was the document opened - is the action acting on a document opened up by the user from a view?

Subject: RE: @command and other ui functions are not allowed in this context

users open the document from a view using @Command([Compose];“”;“VacReq”)

then click this action with this code

Sub Click(Source As Button)

Dim Agent As NotesAgent

Dim View As NotesView

Dim ServerNameStr As String

ServerNameStr = db.Server	

Dim ServerName As New NotesName(ServerNameStr)	

If (doc.CheckUnique(0) = 0) Then

	If (PreventInitiatingNewVacationRequest = -1) Then Exit Sub

	doc.CheckUnique = 1

End If

doc.ErrText = ""

If uidoc.editmode Then

	Call uidoc.save 

End If 

	Set Agent = db.GetAgent("(Validate Employee Balance)")



If Agent.RunOnServer(doc.NoteID) = 0 Then

	Set View = db.getview("(UNID)")

	Call View.refresh

			Z = Cstr(doc.UniversalID)

	Set doc = View.getdocumentBykey(Z)

	If (doc Is Nothing) Then

		Messagebox "An Error occured please contact your Notes Administrator",16, "Failure"

	Elseif doc.ErrText(0) <> "" Then

		Messagebox doc.ErrText(0),16, "Failure"

	Else

		uidoc.close

		Set uidoc = ws.EditDocument(True,doc)

	End If

	Set doc = uidoc.document

Else

	Messagebox "Could not retrive data",16, "Failure"

End If

End Sub

now you have the picture

any ideas

thanks for supporting

Subject: RE: @command and other ui functions are not allowed in this context

  1. You haven’t declared and set “doc” at the start of your code2. You only set uidoc towards the end of your code

  2. Use “Option Declare” or “Option explicit”

  3. There is no NotesUIDocument “feature” in ND6 that specifically results in this error; check for other code that is triggerred upon saving

Subject: RE: @command and other ui functions are not allowed in this context

I presume your uidoc and doc are instantiated somewhere else e.g. in the postOpen event.

Maybe this is related to your problem. Try using a seperate uidoc instance in your action button e.g.

Set ws = New NotesUIWorkSpace

Set uidoc2 = ws.currentDocument

and doing the save on uidoc2

Have you stepped through the code to ensure it is the uidoc.save that causes the error?

I shall look in tommorrow to see if you have solved your problem - good luck

Subject: RE: @command and other ui functions are not allowed in this context

I tried using a separate UIdoc but the same error appears in the same line of codecall uidoc2.save

I think it is about a difference between r5 and r6

Subject: RE: @command and other ui functions are not allowed in this context

the only other thing I can think of is that the error is in an event that the save triggers. I’ve already mention the querySave event. Check all other events and input validation formula.

Can you save the document with the save icon on the tool bar without getting an error?

Subject: RE: @command and other ui functions are not allowed in this context

Hello Glen:No I cannot Save from a save button with out the error I get the error any time and any where I save

thank you very much Glen