Scripting Engine > Script Examples

List Company Contacts

This example lists the top 10 contacts and their companies:

' Find all contacts

Output.textbox = ""

Set rs = TriSysDatabase.OpenRecordset( _

"Select top 10 * from v_Contact_AllFields " & _

              " Where Contact_Company is not null" & _

              " Order by Contact_Surname, Contact_Christian")

Do While Not rs.eof

       Output.textbox = Output.textbox & vbcrlf & _

              rs.fields("Contact_FullName").value & ", " & _

              rs.fields("Contact_Company").value

       rs.MoveNext

Loop

rs.Close

When executed, this is displayed in the output window: