Solved

Search document by view.

Posted on 2004-04-21
7
337 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
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.

 
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

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

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.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

13 Experts available now in Live!

Get 1:1 Help Now