QuerySave Event and dialog box

I currently have a dialog box which is supposed to be pulling information from the main form (a new document). What it is doing is pulling from whatever document has been selected in a view.

Any ideas how to make this code work thru the backend only?

Thanks,

Sub Querysave(Source As Notesuidocument, Continue As Variant)

Dim ws As New NotesUIWorkspace

Dim session As New NotesSession

Dim db As NotesDatabase

Set db = session.CurrentDatabase

Dim docCurrent As NotesDocument

Set docCurrent=source.document





docCurrent.Form = "dlgSendIT" 

Call docCurrent.save(False, True )

Call ws.DialogBox( "dlgSendIT", True, True ) 

Call docCurrent.save(False, True )

Call docCurrent.Send( True )

End Sub

Also, I need the dialog box to populate certain fields on the main form. This isn’t happening.

Subject: QuerySave Event and dialog box

If you look at the dialogbox method in Designer Help, you’ll see that you can add a parameter to specify which document the dialogbox should use. If you don’t specify anything, it will use the current or selected document.

flag = notesUIWorkspace.DialogBox( form$ , [autoHorzFit] , [autoVertFit] , [noCancel] , [noNewFields] , [noFieldUpdate] , [readOnly] , [title$] , [notesDocument] , [sizeToTable] , [noOkCancel] , [okCancelAtBottom] )

Subject: QuerySave Event and dialog box - Need help

Whatever I’m doing its wrong. I have the following code calling a dialog box from a main form called “ToDoItem”. The dialogbox “dlgSendIT” is pulling its values from the document in the view which isn’t what I want. I want the dialogbox populated by the fields in the main form.

Once these fields are edited in the dialogbox I want them to again to populate the corresponding fields in the main document.

Can anyone offer guidance here? I’m not strong in LotusScript. Right now regardless of what form I use as the last perimeter it uses the document in the view.

Thanks,

Sub Querysave(Source As Notesuidocument, Continue As Variant)

Dim ws As New NotesUIWorkspace

Dim session As New NotesSession

Dim db As NotesDatabase

Set db = session.CurrentDatabase

Dim docCurrent As NotesDocument



Set docCurrent=source.document





docCurrent.Form = "dlgSendIT" 





Call ws.DialogBox( "dlgSendIT", True, True, True, False, False, False, "dlgSendIT") 

Call docCurrent.save(False, True )

Call docCurrent.Send( True )

End Sub

Subject: RE: QuerySave Event and dialog box - Need help

Call ws.DialogBox( “dlgSendIT”, True, True, True, False, False, False, “dlgSendIT”)

You’re supposed to specify the Notesdocument, not the form name - the last dlgSendIT parameter should be replaced with the name of the Notesdocument - without quotes.

Subject: RE: QuerySave Event and dialog box - Need help

I’ve made the following changes but now I’m getting a message “Illegal Circular USE: sharedFunctions”.

Second problem is that it doesn’t pull the value of the current document but from that selected in the view instead. How do I fix that? Please help!

Thanks,

Sub Querysave(Source As Notesuidocument, Continue As Variant)

Dim ws As New NotesUIWorkspace

Dim session As New NotesSession

Dim db As NotesDatabase

Set db = session.CurrentDatabase

Dim docCurrent As NotesDocument

Set docCurrent=source.document





docCurrent.Form = "ToDoItem" 

Call ws.DialogBox( "Test Layout", True, True, True, True,False, False, "This is a test") 

Call docCurrent.save(False, True )

Call docCurrent.Send( True )

End Sub

Subject: RE: QuerySave Event and dialog box - Need help

Check the parameters – Dialogbox expects the window title to appear before the document.

Subject: RE: QuerySave Event and dialog box - Need help

Hi Stan,I’ve made some changes but its still pulling from the doc selected from the view rather than the new main document. Any ideas of how to correct this? Thanks!

Sub Querysave(Source As Notesuidocument, Continue As Variant)

Dim ws As New NotesUIWorkspace

Dim session As New NotesSession

Dim db As NotesDatabase

Set db = session.CurrentDatabase

Dim docCurrent As NotesDocument

Set docCurrent=source.document





docCurrent.Form = "ToDoItem" 

Call ws.DialogBox( "Test Layout", True, True, True, False, False, False, "This is a test", docCurrent) 

Call docCurrent.save(False, True )

Call docCurrent.Send( True )

End Sub

Subject: RE: QuerySave Event and dialog box - Need help

Angie, don’t know if you still need help here, but where is this code called from? Is it called from a new document that is opened in the UI? I’m a little unclear why, if there’s a document open in the UI, that Source would point to a document selected in some view.