Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use db.Search function?

Status
Not open for further replies.

jumpjack

Programmer
Jul 28, 2006
79
IT
Where do I find the complete syntax of the first parameter of NotesDatabase.Search function?
In other words, how can I get db.Search function to retrieve all documents containing a selected value into one field?

[...]
Parameters
formula$
String. A Notes @function formula that defines the selection crite

-- Jumpjack --
 
note:
I mean, from within a VBA application in MS access.


-- Jumpjack --
 
Ok, got the solution:

Code:
[...]
    Set session = CreateObject("Notes.Notessession") ' Connect to Lotus
    Set db = session.GETDATABASE(SERVER, DBNAME) ' Open DB
    If db.ISOPEN = False Then
      MsgBox ("Impossibile aprire db '" & DBNAME & "'")
    End If
        
    Set dateTime = session.CREATEDATETIME(DateString) ' Convert date to Notes format
    Set view = db.GETVIEW(VIEWNAME) ' Select view
    
    ' Perform the search of value FieldContents in field FieldName, for documents modified after DateTime
    Set GlobalCollection = db.SEARCH("@Contains(" & FieldName & ";" & FieldContents & ")", dateTime, 0)
    c = GlobalCollection.count ' Number of results
    Set Doc = GlobalCollection.GETFIRSTDOCUMENT
    While Not (Doc Is Nothing)
      Debug.Print Doc.GETITEMVALUE(FieldName2)(0)
      Set Doc = GlobalCollection.GETNEXTDOCUMENT(Doc)
    Wend
    MsgBox "Documents found: " & c

This code works from within a MS Access 97 database.

Here you find all keywords you can use as first parameter of .SEARCH function:
(Lotus designer - vol. 1)
(Lotus designer - vol. 2)

-- Jumpjack --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top