Public Sub LoadMemberships()



   Dim oMemberships As CMemberships

   Dim oMem As CMembership

   Dim sSQL As String

   

   sSQL = "(DBO.MEMBERSHIPS.PrimaryMember = -1) AND DBO.MEMBERSHIPS.ID in " & _

          "(SELECT DBO.MEMBERSHIPS.ID FROM (((DBO.MEMBERSHIPS INNER JOIN " & _

          "DBO.MEMBERSHIPTRANSACTION ON MEMBERSHIPS.CURRENTTRANSACTIONID = " & _

          "DBO.MEMBERSHIPTRANSACTION.ID) INNER JOIN DBO.MEMBERSHIPCATEGORY ON " & _

          "DBO.MEMBERSHIPTRANSACTION.CATEGORY = " & _

          "DBO.MEMBERSHIPCATEGORY.MEMBERSHIPCATEGORYID) INNER JOIN " & _

          "DBO.TABLEENTRIES ON DBO.MEMBERSHIPCATEGORY.CATEGORYID = " & _

          "DBO.TABLEENTRIES.TABLEENTRIESID) WHERE " & _

          "(((DBO.TABLEENTRIES.LONGDESCRIPTION ='Patron' AND " & _

          "DBO.MEMBERSHIPS.Standing =1))))"

   Set oMemberships = New CMemberships

   oMemberships.Init REApplication.SessionContext, tvf_Membeship_CustomWhereClause, sSQL

   

   Debug.Print oMemberships.Count

   For Each oMem In oMemberships

       Debug.Print oMem.Fields(MEMBERSHIP_fld_MemberTableID)

       oMem.CloseDown

   Next oMem

   Set oMem = Nothing

   oMemberships.CloseDown

   Set oMemberships = Nothing

   

End Sub

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.