Solved

Search document by view.

Posted on 2004-04-21
7
341 Views
Last Modified: 2013-12-18
Can somebody please inform me what's missing?
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Dim composed As String
Dim db As NotesDatabase
Dim view As NotesView
Dim dc As NotesDocumentCollection
Dim item As NotesItem
Set uidoc = workspace.CurrentDocument
composed = uidoc.FieldGetText("titlenum" )
Set db = session.CurrentDatabase
Set view = db.GetView("ECN Date")
Set dc = view.GetAllDocumentsByKey(composed, True)
Set doc = dc.GetFirstDocument()
If dc Is Nothing Then
  Messagebox composed,, "Not found"
Else
  Messagebox composed
  Set item = doc.ReplaceItemValue("fld_ECN_seqnum", fld_ECN_seqnum ) --- Gives me an error Object variable not set
  Msgbox fld_ECN_seqnum
  Call doc.Save( False, True )
End If      
0
Comment
Question by:cyle
  • 5
7 Comments
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 10878661
Missin "O"
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 10878669
     Dim workspace As New NotesUIWorkspace
      Dim session As New NotesSession
      Dim uidoc As NotesUIDocument
      Dim composed As String
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim dc As NotesDocumentCollection
      Dim item As NotesItem
      Set uidoc = workspace.CurrentDocument
      composed = uidoc.FieldGetText("titlenum" )
      Set db = session.CurrentDatabase
      Set view = db.GetView("ECN Date")
      Set dc = view.GetAllDocumentsByKey(composed, True)
      Set doc = dc.GetFirstDocument()
      If doc Is Nothing Then            ' Changed dc to doc
            Messagebox composed,, "Not found"
      Else
            Messagebox composed
            Set item = doc.ReplaceItemValue("fld_ECN_seqnum", fld_ECN_seqnum ) '--- Gives me an error Object variable not set
            Msgbox fld_ECN_seqnum
            Call doc.Save( False, True )
      End If    
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 10878683
That was a logical deduction. Though, if dc is initialized and dc.GetFirstDocument() does return a doc object, it wont hurt. But if somehow doc is not initialized it iwll say what it says!!
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 250 total points
ID: 10878715
Or Better

    Dim workspace As New NotesUIWorkspace
     Dim session As New NotesSession
     Dim uidoc As NotesUIDocument
     Dim composed As String
     Dim db As NotesDatabase
     Dim view As NotesView
     Dim dc As NotesDocumentCollection
     Dim item As NotesItem
     Set uidoc = workspace.CurrentDocument
     composed = uidoc.FieldGetText("titlenum" )
     Set db = session.CurrentDatabase
     Set view = db.GetView("ECN Date")
     Set dc = view.GetAllDocumentsByKey(composed, True)
If dc.Count > 0 then
         Set doc = dc.GetFirstDocument()
          Messagebox composed
          Set item = doc.ReplaceItemValue("fld_ECN_seqnum", fld_ECN_seqnum )
          Msgbox fld_ECN_seqnum
          Call doc.Save( False, True )
End if

~Hemanth
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 10878776
Logic changed!?!
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 10878828
My solution didn't work?!?!?!? It was good by all means!
0
 

Author Comment

by:cyle
ID: 10878874
Sorry, but it didn't update the field in the othe form.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

828 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