I'm trying to get input from user and replace the user entered value in particular field. I have tired the below code but i'm getting an "Object variable not set error". Not sure about where i'm missing. Please help to resolve this error. Thanks in advance.
Dim ws As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim item As NotesItem
Set db = session.CurrentDatabase
rfield = Inputbox("enter name")
If rfield = "" Then
Exit Sub
End If
nval = Inputbox("Enter the purpose ")
Call doc.ReplaceItemValue( Cstr(rfield), "Name")
Call doc.ReplaceItemValue(Cstr(nval),"Purpose")
Call doc.Save(False,True)
End Sub
You have not initialised the doc
variable. You can set it like this:
set doc = ws.currentdocument.document
As an aside, you should also read up on error trapping. This will help you find out which line is causing issues.