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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lotus Script

Status
Not open for further replies.

Gary74

IS-IT--Management
Apr 25, 2011
3
US
I am using Lotus Notes 6.5. I got this script from the web.The only problem that i have is when the user click on "cancel" the script still runs. Please help!

Thanks in advance....


Sub Click(Source As Button)
Dim nsesCurrent As New NotesSession
Dim nuiwsCurrent As New NotesUIWorkspace
Dim ndbCurrent As NotesDatabase
Dim ncolSelected As NotesDocumentCollection
Dim ndocOrder As NotesDocument
Dim StrExpireDate As String

StrExpireDate = nuiwsCurrent.Prompt(3,"New Field Value","Please enter the new field value.")

Set ndbCurrent = nsesCurrent.CurrentDatabase
Set nColSelected = ndbCurrent.UnprocessedDocuments
Set ndocOrder = ncolSelected.GetFirstDocument
Do While Not (ndocOrder Is Nothing)
With ndocOrder
.ExpireDate = StrExpireDate
End With
Call ndocOrder.Save(True, True)
Set ndocOrder = ncolSelected.GetNextDocument(ndocOrder)
Loop
End Sub
 
I am using Lotus Notes 6.5. I got this script from the web. Now I'm getting "Variant does not contain a container". Please Help!

Thanks in advance.....

Sub Click(Source As Button)
Dim nsesCurrent As New NotesSession
Dim nuiwsCurrent As New NotesUIWorkspace
Dim ndbCurrent As NotesDatabase
Dim ncolSelected As NotesDocumentCollection
Dim ndocOrder As NotesDocument
Dim StrExpireDate As Variant

StrExpireDate = nuiwsCurrent.Prompt(3,"New Field Value","Please enter the new field value.")

If Isempty(StrExpireDate) Then Exit Sub

If Trim$(StrExpireDate(0)) Then Exit Sub

Exit Sub

Set ndbCurrent = nsesCurrent.CurrentDatabase
Set nColSelected = ndbCurrent.UnprocessedDocuments
Set ndocOrder = ncolSelected.GetFirstDocument
Do While Not (ndocOrder Is Nothing)
With ndocOrder
.ExpireDate = StrExpireDate(0)
Call .Save(True, True)
End With
Set doc = ncolSelected.GetNextDocument(ndocOrder)
Loop
End Sub
 
Did you mean this line:

If Trim$(StrExpireDate(0)) Then Exit Sub

to be

If Trim$(StrExpireDate(0)="") Then Exit Sub

?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top