Help with finding a Object Not Set

I have a very simple form that I copied from a differnt database.  When I go to save the copied form, I get the prompt box

Object Variable Not Set  - what is the best way to try and find the variable.  This is a exact copy of the form from the other database that works fine.  I am not sure where the variable could be hiding.  Any suggestions would be great.

Jaziar
JaziarAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
p_parthaConnect With a Mentor Commented:
Set lookupView = db.getView("LookupDocByDocID"), then that means there is no view by that name
Check the spelling


Partha
0
 
HemanthaKumarCommented:
Use debugger to find out which line is giving this error.. .then you know what variable is not set !

~Hemanth
0
 
JaziarAuthor Commented:
Set backEndDoc = lookupView.GetDocumentByKey(frontEndDoc.UniversalID)

Here is the line - could you explain a little what he is trying to do here.  I will paste all the querysave for reference

Sub Querysave(Source As Notesuidocument, Continue As Variant)
      Dim doc As NotesDocument
      
      Set doc = Source.Document
      frontEndFieldContent = Source.FieldGetText("MachineRemarks")
      
      If Not doc Is Nothing Then
            If Right(frontEndFieldContent, 1) <> ")" And  frontEndFieldContent <> "" Then
                  Call Source.FieldAppendText("MachineRemarks", "   " & getEntryStamp())
            End If
      End If
      
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim ws As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Dim lookupView As NotesView
      
      Set  db = session.CurrentDatabase
      Set uidoc = ws.CurrentDocument
      Set lookupView = db.getView("LookupDocByDocID")
      
      Dim frontEndDoc As NotesDocument
      Dim backEndDoc As NotesDocument
      
      Set frontEndDoc = uidoc.Document
      Set backEndDoc = lookupView.GetDocumentByKey(frontEndDoc.UniversalID)
      
      If Not backEndDoc Is Nothing Then
            Call CompareAndUpdateOwners(frontEndDoc, backEndDoc)
      End If
End Sub
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
p_parthaCommented:
Frontenddoc is a uidoc and it's not even saved, how do u expect it's universalid to be in lookupview

Partha
0
 
JaziarAuthor Commented:
The problemis I did not write, I got assigned to make it work.  The other programmer is no longer with us
0
 
p_parthaCommented:
Jaziar
I am sorry, i didn't see it was in querysave, ANyways things u need to check:

a. check whether lookupview object is set, When you start the debugger  u see a twistie for the lookupview object


He checks whether the document exists, if it doesn't then he calls the compareandupdateowners function

Partha
0
 
RanjeetRainCommented:
Root of all the problems is this line:

Set frontEndDoc = uidoc.Document

You can't do it.
0
 
RanjeetRainCommented:
When you try accessing the Document property of the uidoc object, it doesn't return a valid NotesDocument object. Hence, your next line fails.

Correct this line >> Set frontEndDoc = uidoc.Document<<

YOu will probably need to use an alternate approach to solve this problem. Anyview that uses UniversalID of a document as a key, will not serve you a purpose in case you try looking up a NEW document that has never been saved. Yes, this code will work just fine on documents that have been saved earlier and are being edited.
0
 
p_parthaCommented:
I disagree with ranjeet

Partha
0
 
JaziarAuthor Commented:
P_Partha There is no twistie when the bugger starts on LookupView
0
 
JaziarAuthor Commented:
The view spelling was off - Thanks very much and nice job
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.