LS error - Fuction requires a valid ADT arguement

Hello All,

I am having trouble by getting the error as shown in subject. I cannot run LS debugger because I get this error first hand. Would someone Please take a gander and see what I am missing? Thanks so much in Advance.

I am trying to copy some fields over from one form to another and keep the second one open so the user can still finish filling out the form.

    Sub Click(Source As Button)	

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument	

Dim session As New notessession

Dim db As notesdatabase

Dim newdoc As notesdocument

Set db=session.currentdatabase

Set uidoc=ws.CurrentDocument

Set newdoc=New notesdocument(db)



newdoc.Form="Contact"



Dim Company As String

Dim cophone As String

Dim companyfax As String

Dim Address1 As String

Dim Address2 As String

Dim Address3 As String

Dim City As String

Dim State As String

Dim Zip As String

Dim Country As String



Company = uidoc.FieldGetText( "Company")

cophone = uidoc.FieldGetText( "cophone")

companyfax = uidoc.FieldGetText( "companyfax")

Address1 = uidoc.FieldGetText( "Address1")

Address2 = uidoc.FieldGetText( "Address2")

Address3 = uidoc.FieldGetText( "Address3")

City = uidoc.FieldGetText( "City")

State = uidoc.FieldGetText( "State")

Zip = uidoc.FieldGetText( "Zip")

Country = uidoc.FieldGetText( "Country")



newdoc.Company = Company

newdoc.cophone = cophone

newdoc.companyfax = companyfax

newdoc.Address1 = Address1

newdoc.Address2 = Address2

newdoc.Address3 = Address3

newdoc.City = City

newdoc.State = State

newdoc.Zip = Zip

newdoc.Country = Country

Set uidoc = ws.EditDocument( True, uidoc, False )		

End Sub

Subject: LS error - Fuction requires a valid ADT arguement

Set uidoc = ws.EditDocument( True, uidoc newdoc, False )

If you add Option Explicit to your script the compiler will most likely catch this.

Subject: RE: LS error - Fuction requires a valid ADT arguement

Thank you very very much! - Thomas

That worked, I am new to LS and I was just looking at a lot of examples and I was able to write what I had.

Not sure what you mean by adding “Option Explict” ???

Subject: RE: LS error - Fuction requires a valid ADT arguement

Add “Option Explicit” to the Options event of your button. Actually it is a good idea to add this to all such scripts. You could instead add Option Declare which means the same thing. This tells the compiler to resolve all objects when you save the form; it won’t save if any variable is left undeclared or any object is of the wrong type. A lot of bugs will be prevented thereby.