I have a button in a form that I want to be able to choose one or more clients to create another form for. The problem is for each client I want to create multiple copies of the target form (Recurring event) based on the event type. Hope this makes sense. What I get is Type Mismatch when the PROMPT box comes up. What am I missing? Any help is appreciated. The code is below:
Sub Click(Source As Button)
Dim Session As New NotesSession
Dim Workspace As New NotesUIWorkspace
Dim db_Current As NotesDatabase
Dim Doc_Client As NotesDocument
Dim Doc_Event As NotesDocument
Dim DC_Client As NotesDocumentCollection
Dim Event_Type As Variant
Dim Event_List(0 To 8) As Variant
Event_List(0)="PM Audit"
Event_List(1)="Client Survey"
Event_List(2)="Account Review"
Event_List(3)="Technology Planning"
Event_List(4)="SLA - Client Service Plan"
Event_List(5)="RSM - Client Service Plan"
Event_List(6)="HSHS - Client Service Plan"
Event_List(7)="Website and E-mail Hosting - Client Service Plan"
Event_List(8)="Security Assessment - Client Service Plan"
Dim Client_List( ) As String
Set db_Current = Session.CurrentDatabase
Set DC_Client = Workspace.PickListCollection( 1 ,True , "mercury/Walker", "ClientServices\CLIENT95.nsf", "Contract Type" , "Client List" , "Select Client names to create Recurring event for" )
If DC_Client.Count < 1 Then Exit Sub
Redim Client_List( 1 To DC_Client.Count )
Event_Type = Workspace.Prompt(PROMPT_OKCANCELLISTMULT,"Enter the Event Type", "Event", "", Event_List)
For i = 1 To DC_Client.Count
Set Doc_Event = New NotesDocument( db_Current )
Set Doc_Client = DC_Client.GetNthDocument( i )
If Event_Type >1 Then
Forall e In Event_Type
Doc_Event.Form = "Recurring Event" ' Put the form name for the recurring event document here
Doc_Event.Event = e
End Forall
End If
’ Replace the name of the actual client name field on the right hand side of the statement.
Client_List( i ) = Doc_Client.CompanyName( 0 )
’ Example of assigning values to the event form. Replace field names accordingly
Doc_Event.CompanyName = Doc_Client.CompanyName( 0 )
Doc_Event.ClientCode = Doc_Client.ClientCode(0)
Doc_Event.ClientManager = Doc_Client.ClientManager(0)
Doc_Event.TSM = Doc_Client.TSM(0)
’ Save the event document
Call workspace.EditDocument(True,Doc_Event)
Call workspace.CurrentDocument.Refresh
Call workspace.CurrentDocument.Gotofield("Reason")
Next