Posted on 2002-06-10
Can anyone point me in the right direction, I am fairly new to Lotus Script.
I am pulling fields through an ODBC connection into a database to fill a form. I built the following code to do that. This is in the postopen event of a form in the notes database and works great at pulling the first record and populating the appropriate fields.
Sub Postopen(Source As Notesuidocument)
Dim uidoc As NotesUIDOcument
Dim note As NotesDocument
Dim Con As New ODBCConnection
Dim qry As New ODBCQuery
Dim result As New ODBCResultSet
qry.SQL= "SELECT tblMasterOARFControl.BANK," _
& "tblMasterOARFControl.OBLIGOR, tblMasterOARFControl.OBLIGATION, " _
& "tblMasterOARFControl.CUSTNAME, tblMasterOARFControl.COLLTYPE, " _
& "tblMasterOARFControl.MATDATE, tblMasterOARFControl.ITEM, " _
& "tblMasterOARFControl.FirstOfCOLLDESC1, tblMasterOARFControl.FirstOfCOLLDESC2," _
& "tblMasterOARFControl.OFFCRCODE, tblMasterOARFControl.PREPAY, " _
& "tblMasterOARFControl.txt_EMAILADD, tblMasterOARFControl.txtGoodtoSend, " _
& "tblMasterOARFControl.txtOrigSendDate " _
& "FROM tblMasterOARFControl WHERE (((tblMasterOARFControl.txtGoodtoSend)=-1));"
If result.IsResultSetAvailable Then
Dim ws As New NotesUIWOrkspace
Dim Obligor As String
Dim Obligation As String
Dim Item As String
Set uidoc = ws.CurrentDocument
Set note = uidoc.Document
Set doc = ws.CurrentDocument.Document
Now the fun part, I need it to move to the next row and evaluate the Obligor, Obligation fields on the info that was pulled in. If the two are equal, I need to to evaluate the Item field, if it is the same, skip the record. If it is different, then scrape the new item #, new colldesc1 and colldesc2 into those fields (which are built to allow multiple values). If the Obligor is different, it will close and send the doc to the addressee (which is scraped in). Then I need to to open another doc and start all over.
I tried to use Lotus Help and a couple of web sites, but I could not find any code that would help. Thanks all!!