Variant does not contain an object

I’ve got the following code that is behind an action button on a call logging form, the button Reassigns the call to another person. It brings up the dialog box to select a name but then comes back with the error ‘Variant does not contain an object’

Any ideas would be gratefully recieved

Thanks

Claire

Sub Click(Source As Button)

'Declare the objects

Dim session As New notessession

Dim workspace As New notesuiworkspace

Dim db As notesdatabase

Dim uidoc As notesuidocument

Dim doc As notesdocument

Dim checkdoc As notesdocument

'Declare the main objects

Set db = session.CurrentDatabase

Set uidoc = workspace.CurrentDocument

Set doc = uidoc.Document

'Create a new dummy document for the results of the dialog box

Set checkdoc = New notesdocument(db)

'Display the dialog box

keypress = workspace.dialogbox(“dlgChecker”, True, True, False, False, False, False, “Select Checker”, checkdoc)

'Make sure OK was pressed

If (keypress = True) Then

'Make sure a name was entered on the dialog box

If (checkdoc.CCT_Checker(0) <> “”) Then

'Prepare an e-mail to send to the Checker

Set maildoc = New notesdocument(db)

'Set the values on the mail

maildoc.Form = “mailReassignChecker”

maildoc.From = session.UserName

maildoc.DateSent = Now

maildoc.SendTo = checkdoc.CCT_Checker(0)

maildoc.Subject = "Relationship Check Request reassigned to you: " + doc.Client_Name(0)

maildoc.nPreviousChecker = doc.CCT_Checker(0)

maildoc.dLastAssigned = doc.AssignDate(0)

maildoc.tClientName = doc.Client_Name

maildoc.nRequested = session.UserName

maildoc.dRequested = Now

'Set the DocLink on the mail

Set rtitem = New notesrichtextitem(maildoc, “rtLink”)

Call rtitem.AppendDocLink(doc, “Click to access Relationship Check Request”)

'Send the document

maildoc.Send True

'Now reset the status on the document

doc.Status = “A”

doc.AssignDate = Today

doc.CCT_Checker = checkdoc.CCT_Checker(0)

'Update the history to show the request has been assigned

checkername = Evaluate(“@Name([CN]; CCT_Checker)”, doc)

Call UpdateHistory(doc, "Reassigned to " + checkername(0))

End If

'Save the changes

Call doc.save(True, True)

'Now close the document and refresh the view

Call uidoc.Close

Call workspace.ViewRefresh

End If

End Sub

Subject: Variant does not contain an object

To make it possible to debug, you should trap errors, and disply error line. The we can maybe help.

Subject: RE: Variant does not contain an object

As Michael says, you can surely debug this script, and failing that, you can put in error trapping to identify the problem line.

One problem I can tell just from the error message text, is that the author forgot to use Option Declare. Start with that.

I don’t see any lines in this script that seem likely to have caused the error. The conditions that cause this error are described in detail in Debugging Domino Applications part 1 and part 2.

I suspect the problem comes from the call to UpdateHistory.

Subject: Variant does not contain an object

Might it be this line:

maildoc.tClientName = doc.Client_Name

Perhaps you need to add a (0) after Client_Name?

Try turning on your debugger and stepping through the code. That would at least let you track down which line is throwing the error.

Subject: RE: Variant does not contain an object

Thanks, i did turn debugger on but it didn’t give me any information. Its old code from a database i’ve just picked up for enhancements

Thanks again

Claire

Subject: RE: Variant does not contain an object

Did the debugger not come up with you clicked the action button? No matter how old the code is, you should be able to step through it and determine which line it causing the error.

Subject: RE: Variant does not contain an object

Did the debugger not come up when you clicked the action button? No matter how old the code is, you should be able to step through it and determine which line it causing the error.