Adding 2nd Select (DB2) - Agent

I need to pull a couple more fields (different table) into the document. Can I just insert a qry2.SQL=… in the section below before executing the result.execute? …then add “doc.Class_Code = result.GetValue…” after the final line in the script below (+ the second filed)?

Set qry.connection = con

Set result.query = qry

qry.SQL = "SELECT * FROM VENDLIB.TTCCW"

result.Execute

If Not result.isresultsetavailable Then

	Messagebox "Resultset Not Available"			

Else

	Do

		result.NextRow

		'add new document to database for each record in TTCCW

		Set doc = New NotesDocument(db)

		doc.Form = "Vendor Profile"

		doc.Processed = "Yes"

		doc.Vendor_Number = result.GetValue("TTCSNO", lval)

		doc.Vendor_Name = result.GetValue("TTCSNM", string1)

Subject: RE: Adding 2nd Select (DB2) - Agent

I’ve had to add con2, qry2 and result2, with no problems. (If I needed to keep both in memory, or run a second lookup while I had the first in memory).

If you collect and process the first, you can close the result and apply a new qry statement to get a new result.

Subject: RE: Adding 2nd Select (DB2) - Agent

Thanks… will try (had already added qry2 and result2 - but not tested). My assumption was the con should be fine for the entire script.