Solved

Search document by view.

Posted on 2004-04-21
7
334 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

20 Experts available now in Live!

Get 1:1 Help Now