How to set a db name in lotus script; how to remove a connection document

It gave me an error “Not an instance name”. How would I set the db to users’ local address book? My purpose is to remove a connection document from users’ local address book. Sorry, I am very basic on scripting.

Dim session As New NotesSession

Dim db As NotesDatabase

Dim collection As NotesDocumentCollection

Dim doc As NotesDocument

Dim nid As String

’ Set db = session.CurrentDatabase

Set db=names.nsf

Set collection = db.FTSearch(“notesserver2/arthrex”, 0)

Set doc = collection.GetFirstDocument()

Call collection.DeleteDocument(doc)

Subject: how to set a db name in lotus script; how to remove a connection document

Set db = session.GetDatabase(“”,“names.nsf”)

Subject: RE: how to set a db name in lotus script; how to remove a connection document

Thanks much! now my code looks like this but still not working, do you know why? It’s just not deleting anything out of my connection list.

Dim session As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim vc As NotesViewEntryCollection

Set db = session.getdatabase(local,"names.nsf")

Set view = db.GetView("Connections")

Set vc = view.GetAllEntriesByKey("notesserver2/arthrex")

Call vc.RemoveAll(True)

Subject: RE: how to set a db name in lotus script; how to remove a connection document

You need to run this in the debugger to see whether any view entries are in the collection after you do your search. Of course, the name must match the column value exactly (e.g. “notesserver2” does not match).