The addviaSQLStment contains 2 parameters:



1. The SQL Statement.

2. The IDFieldIndex.  (Number sequence starts at zero)



The following sample code can be modified as necessary:


 
Public Sub addviasql()
    
    Dim oSQ As CStaticQ
    Set oSQ = New CStaticQ
    oSQ.Init REApplication.SessionContext
 
    With oSQ
        .CreateWithoutPrompt SEARCH_GIFT, "Test", "query", , , , , , True
        .AddviaSQLStmt "select gift.id from dbo.gift where gift.dte > '10/27/2005'", 0
        .EndCreate Nothing
    End With
 
    Set oSQ = Nothing
    
End Sub


In the above example there is one select field i.e. the id field so the "IDFieldIndex" that corresponds to it is 0. If the id field were the third field in the SQL statement, the IDFieldIndex would be 2.

Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Our Customer Support can help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality. If you are interested in learning more about the VBA and API modules, contact your account manager.