And here I was, thinking that I was getting close with my code.
I am working on code to pull field information from Form A to a newly created Form B.
My code gives me the error ‘Type Mismatch’ and debugger shows that it stops on the line ‘fDrop = fdoc.Drop’. I originally had fDrop dimmed as a NotesItem but using Case caused all sorts of errors that seemed to want it to be a string, so I changed all of the code to accomodate this.
The field referred to by ‘Drop’ is a text field if that is any help. I have been looking at and working with this code for long enough today that I am getting a little loopy.
Any help would be great:
Dim ws As New NotesUIWorkspace
Dim session As New NotesSession
Dim plist As NotesDocumentCollection
Dim db As NotesDatabase
Dim fdb As NotesDatabase
Dim view As NotesView
Dim fview As NotesView
Dim item As NotesItem
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Dim fdoc As NotesDocument
Set db = session.CurrentDatabase
Set fdb = session.GetDatabase(“AppServer”, “folder/database.nsf”)
Set view = db.GetView( “dbView”)
Set fview = fdb.GetView( “fdbView” )
Set plist = ws.PickListCollection(PICKLIST_CUSTOM, True, “AppServer”, “folder/database.nsf”, “View”, “Title”, “Prompt.”)
Set fdoc = plist.GetFirstDocument
Set uidoc = ws.ComposeDocument( “”, “”, “Form”)
Set doc = uidoc.Document
doc.fromfield1 = fdoc.tofield1
doc.fromfield2 = fdoc.tofield2
doc.fromfield3 = fdoc.tofield3
doc.fromfield4 = fdoc.tofield4
doc.fromfield5 = “field5info”
doc.fromfield6 = “field6info”
Dim fDrop As String
Dim DropYr As String
Dim DropQtr As String
Dim DropDate As String
fDrop = fdoc.Drop
Select Case fDrop
Case 1 = Evaluate(|@Contains(“Drop”; “.1”)|, fdoc)
DropQtr = “1Q”
Case 2 = Evaluate(|@Contains(“Drop”; “.2”)|, fdoc)
DropQtr = “2Q”
Case 3 = Evaluate(|@Contains(“Drop”; “.3”)|, fdoc)
DropQtr = “3Q”
Case 4 = Evaluate(|@Contains(“Drop”; “.4”)|, fdoc)
DropQtr = “4Q”
End Select
If Evaluate(|@Contains(“Drop”; @Text(@Year(@Today)))|, fdoc) Then
DropYr = Cstr(Year(Today))
End If
If Evaluate(|@Contains(“Drop”; @Text(@Year(@Adjust(@Today; -1; 0; 0; 0; 0; 0))))|, fdoc) Then
DropYr = Cstr(Year(Today)-1)
End If
DropDate = DropQtr + " - " + DropYr
Dim DSview As NotesView
Dim DSdoc As NotesDocument
Set DSview = db.GetView(“DSView”)
Set DSdoc = DSview.GetDocumentByKey(“DSForm”, True)
If DropDate = DSDoc.Field1 Then
doc.field7 = DSdoc.field1
doc.field8 = DSDoc.field2
End If