?
Solved

Search document by view.

Posted on 2004-04-21
7
Medium Priority
?
347 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
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.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 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