Solved

Search document by view.

Posted on 2004-04-21
7
344 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
Independent Software Vendors: 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 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

Technology Partners: 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

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

705 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