I’m using a button in a form to generate multiple documents with sequential SN’s (Prefix + number). If I remove the looping code, it generates 1 document. If I try to use a for loop to generate multiples, (using qty, startSN, prefix and stopSN) I get a Type mismatch at:
stopSN = startSN + qty
Also, when I try to generate doc2.SNPart by concatonating prefix & i, (even without the loop code) I also get a type mismatch.
Can anyone give me some help?
Thanks,
Angelo
==============================
Sub Click(Source As Button)
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim doc2 As NotesDocument
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
Set db = session.CurrentDatabase
Set doc2 = New NotesDocument(db)
Dim SNPartType As String
Dim SNPrefix As String
Dim SNPart As String
Dim PartNumber As String
Dim Description As String
Dim VendorCode As String
Dim NextSocketSN As Integer
Dim BuildDate As NotesDateTime
qty = doc.SNQty
startSN = doc.NextSocketSN
prefix = doc.SNPrefix
’ stopSN = startSN + qty
’ For i = startSN To stopSN
Set doc2 = db.CreateDocument
doc2.SNPart = "Does not Work" ' was prefix & i
doc2.PartNumber = doc.PartNumber
doc2.Description = doc.Description
doc2.VendorCode = doc.VendorCode
doc2.BuildDate = doc.BuildDate
doc2.Form = "SN Part"
Call doc2.Save( True, True)
’ Next
Msgbox "Part Number Generation Complete. Refresh PartSN View to view new part numbers.",,"Success!"
End Sub