Solved

Error:  Variant does not contain an object

Posted on 2004-08-04
6
4,373 Views
Last Modified: 2013-12-18
Hi

I am getting a Variant does not contain an object error
I am prett sure it has to do with the emaildoc declaration

HHMMmm
Sub SendCORP
      On Error Goto AnyOtherErrors
      Print "SendingNotification"
      Dim ws As New NotesUIWorkspace
      Dim emailDoc As NotesDocument
      Dim rtitem As NotesRichTextItem
      Dim db As NotesDatabase
      Dim s As New NotesSession
      Set DB = S.CurrentDatabase
      Set db = session.CurrentDatabase
      Set emailDoc = New NotesDocument(db)
      Set rtitem = New NotesRichTextItem (emaildoc, "Body")       
      
'E-mail those who need to know
      SendPeople = "Employee1 Guest"
      doc.SendTo = SendPeople
      emailDoc.Form = "Memo"
      emailDoc.SendTo = SendPeople
      emailDoc.CopyTo = "James Wood"
      emailDoc.Subject = "New\Change\Remove User ID " & "("& doc.client(0) & ")"  
      
'Create the body field and put in a doclink
          'Dim rtitem As NotesRichTextItem
      Set rtitem = New NotesRichTextItem(emaildoc, "Body")
      Call rtitem.AppendText( "CTFS New/Change/Delete: "& "- -> "& doc.ChgType(0))
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendText( "CTFS Client's Full Name: "& "- -> "& doc.CFullName(0))
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendText( "CTFS Client's CORP User ID :"& "- -> "& doc.CCorpID(0))
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendText( "CTFS Client's Dept.: "& "- -> "& doc.CDept(0))
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendText( "CTFS Client's Extension: "& "- -> "& doc.CExtension(0))
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendText( "CTFS Clients Manager: "& "- -> "& doc.CManager(0))
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendText( "CTFS Clients Employee #: "& "- -> "& doc.CEmployeeNum(0))
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendText( "Additional Info: "& "- -> "& doc.AddRequirements(0))
      
      
'Compute the computed fields
      Call emailDoc.ComputeWithForm(False, False)
'Send the e-mail
      Call emailDoc.Send (False)
      
      Exit Sub
AnyOtherErrors:
      Msgbox "Erl: " & Erl & Chr(13) & "Err: " & Err & Chr( 13 ) & _
      "Error: " & Error$  
End Sub
0
Comment
Question by:imjamesw
  • 4
  • 2
6 Comments
 
LVL 31

Expert Comment

by:qwaletee
ID: 11720674
James, couldn't you at leat ave run it through the debugger and pointed out which line failed?  You know to do that by now!!!

It may have something to do with the fact that you ditto'ed the following line:
     Set rtitem = New NotesRichTextItem (emaildoc, "Body")      
0
 

Author Comment

by:imjamesw
ID: 11720820


I have been running this thru the debugger

Sorry

This is in the Globals of the form
I think the problem is with  emailDoc.Subject = "New\Change\Remove User ID " & "("& doc.client(0) & ")"  

I did not have doc declared
I have Declared i now

Lets see what happens



0
 
LVL 31

Accepted Solution

by:
qwaletee earned 500 total points
ID: 11720843
Well, that line contains the first reference to doc.  If you run it through the debugger, and stop before that line, you can chekc to see if doc is initialized.

If that's the problem, then you have two problems:

1) doc should have been initialized
2) doc is not declared or is icorrectly, and is being treated as a variant instead of a NotesDocument
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:imjamesw
ID: 11720893
Yeah

Doc is not initialized

I did this before and doc was not set and it worked HHMMm

Since this is in the globals of the form and I need to pull info from the form rather tha write to it how do I set doc
0
 

Author Comment

by:imjamesw
ID: 11721034
I got it

0
 

Author Comment

by:imjamesw
ID: 11721036
I forgot to set doc as uidoc
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now