home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / crystal / extras / crpedemo / groupcon.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-12-15  |  42.5 KB  |  1,067 lines

  1. VERSION 2.00
  2. Begin Form Groupcond 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Group Condition"
  5.    ClientHeight    =   4185
  6.    ClientLeft      =   1305
  7.    ClientTop       =   2055
  8.    ClientWidth     =   7185
  9.    Height          =   4590
  10.    Left            =   1245
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4185
  13.    ScaleWidth      =   7185
  14.    Top             =   1710
  15.    Width           =   7305
  16.    Begin SSFrame Frame3D6 
  17.       Font3D          =   0  'None
  18.       ForeColor       =   &H00000000&
  19.       Height          =   1095
  20.       Left            =   90
  21.       TabIndex        =   15
  22.       Top             =   2280
  23.       Width           =   6975
  24.       Begin TextBox Text4 
  25.          Height          =   330
  26.          Left            =   3810
  27.          TabIndex        =   17
  28.          Text            =   "Text4"
  29.          Top             =   405
  30.          Width           =   2715
  31.       End
  32.       Begin ComboBox CondCombo 
  33.          BackColor       =   &H00C0C0C0&
  34.          Height          =   300
  35.          Left            =   3810
  36.          TabIndex        =   5
  37.          Text            =   "CondCombo"
  38.          Top             =   405
  39.          Width           =   2955
  40.       End
  41.       Begin Label Label7 
  42.          BackColor       =   &H00C0C0C0&
  43.          Height          =   315
  44.          Left            =   4440
  45.          TabIndex        =   4
  46.          Top             =   390
  47.          Visible         =   0   'False
  48.          Width           =   2115
  49.       End
  50.       Begin Label Label6 
  51.          BackColor       =   &H00C0C0C0&
  52.          Caption         =   "The section will be printed:"
  53.          Height          =   315
  54.          Left            =   60
  55.          TabIndex        =   16
  56.          Top             =   390
  57.          Width           =   4305
  58.       End
  59.    End
  60.    Begin SSFrame Frame3D5 
  61.       Font3D          =   0  'None
  62.       ForeColor       =   &H00000000&
  63.       Height          =   1905
  64.       Left            =   90
  65.       TabIndex        =   8
  66.       Top             =   240
  67.       Width           =   6975
  68.       Begin TextBox Text3 
  69.          Height          =   330
  70.          Left            =   3780
  71.          TabIndex        =   3
  72.          Text            =   "Text3"
  73.          Top             =   1350
  74.          Width           =   2745
  75.       End
  76.       Begin TextBox Text2 
  77.          Height          =   330
  78.          Left            =   3780
  79.          TabIndex        =   2
  80.          Text            =   "Text2"
  81.          Top             =   900
  82.          Width           =   2745
  83.       End
  84.       Begin TextBox Text1 
  85.          Height          =   330
  86.          Left            =   3780
  87.          TabIndex        =   1
  88.          Text            =   "Text1"
  89.          Top             =   450
  90.          Width           =   2775
  91.       End
  92.       Begin ComboBox FieldTypeCombo 
  93.          BackColor       =   &H00C0C0C0&
  94.          Height          =   300
  95.          Left            =   3780
  96.          TabIndex        =   12
  97.          Top             =   1350
  98.          Width           =   2985
  99.       End
  100.       Begin ComboBox SortDirCombo 
  101.          BackColor       =   &H00C0C0C0&
  102.          Height          =   300
  103.          Left            =   3780
  104.          TabIndex        =   11
  105.          Top             =   900
  106.          Width           =   2985
  107.       End
  108.       Begin ComboBox GroupCondCombo 
  109.          BackColor       =   &H00C0C0C0&
  110.          Height          =   300
  111.          Left            =   3810
  112.          TabIndex        =   10
  113.          Top             =   450
  114.          Width           =   2985
  115.       End
  116.       Begin Label Label5 
  117.          BackColor       =   &H00C0C0C0&
  118.          Caption         =   "Field Type:"
  119.          Height          =   225
  120.          Left            =   2400
  121.          TabIndex        =   14
  122.          Top             =   1320
  123.          Width           =   1065
  124.       End
  125.       Begin Label Label1 
  126.          BackColor       =   &H00C0C0C0&
  127.          Caption         =   "Sort Direction:"
  128.          Height          =   255
  129.          Left            =   2130
  130.          TabIndex        =   13
  131.          Top             =   900
  132.          Width           =   1305
  133.       End
  134.       Begin Label Label4 
  135.          BackColor       =   &H00C0C0C0&
  136.          Height          =   270
  137.          Left            =   180
  138.          TabIndex        =   9
  139.          Top             =   450
  140.          Width           =   3405
  141.       End
  142.    End
  143.    Begin CommandButton Command3 
  144.       Caption         =   "Done"
  145.       Height          =   330
  146.       Left            =   2610
  147.       TabIndex        =   7
  148.       Top             =   3600
  149.       Width           =   1935
  150.    End
  151.    Begin CommandButton Command2 
  152.       Caption         =   "Set Group Condition"
  153.       Height          =   330
  154.       Left            =   570
  155.       TabIndex        =   6
  156.       Top             =   3600
  157.       Width           =   1935
  158.    End
  159.    Begin CommandButton Command1 
  160.       Caption         =   "Help"
  161.       Height          =   330
  162.       Left            =   4650
  163.       TabIndex        =   0
  164.       Top             =   3600
  165.       Width           =   1935
  166.    End
  167. Dim GroupNumber As Integer
  168. Dim NGroups As Integer
  169. Dim Sortdirection(0 To 10) As Integer
  170. Dim MYTYPE(0 To 10) As Integer
  171. Dim MYCONDITION(0 To 10) As Integer
  172. Dim SCode1 As Integer
  173. Dim Cond As Integer
  174. Dim SortDir As Integer
  175. Sub Command2_Click ()
  176. 'MsgBox Str(Scode) & "Section"
  177. 'MsgBox Text1.Text & "Field Name"
  178. 'MsgBox Str(Cond) & "Condtion"
  179. 'MsgBox Str(SortDir) & "Sort Direction"
  180. If PESetGroupCondition(Jobnum, Scode, Text1.Text, Cond, SortDir) = False Then
  181.   RCode = GetErrorString(Jobnum)
  182.   MsgBox "PESetGroupCondition Error #: " + Str(ErrorCode) + " - " + RCode
  183.   Exit Sub
  184. End If
  185. End Sub
  186. Sub Command3_Click ()
  187.  Unload Me
  188. End Sub
  189. Sub Command4_Click ()
  190.  SortDirCombo.Enabled = True
  191.  FieldTypeCombo.Enabled = True
  192.  CondCombo.Enabled = True
  193.  Command2.Enabled = True
  194. End Sub
  195. Sub CondCombo_Change ()
  196.  Text4.Text = CondCombo
  197. End Sub
  198. Sub CondCombo_Click ()
  199.  Text4.Text = CondCombo
  200.  Cond = CondCombo.ListIndex
  201. End Sub
  202. Sub FieldTypeCombo_Click ()
  203. Text3.Text = FieldTypeCombo.Text
  204.  If FieldTypeCombo.ListIndex = 0 Then
  205.    CondCombo.Clear
  206.    CondCombo.Visible = True
  207.    Label7.Visible = False
  208.    Label6.Caption = "The section will be printed:"
  209.    CondCombo.Text = "for each Day"
  210.    Text4.Text = "for each Day"
  211.    CondCombo.AddItem "for each Day"
  212.    CondCombo.AddItem "for each Week"
  213.    CondCombo.AddItem "for each Two Weeks"
  214.    CondCombo.AddItem "for each Half Month"
  215.    CondCombo.AddItem "for each Month"
  216.    CondCombo.AddItem "for each Quarter"
  217.    CondCombo.AddItem "for each Half Year"
  218.    CondCombo.AddItem "for each Year"
  219.  Else
  220.    If FieldTypeCombo.ListIndex = 1 Then
  221.      CondCombo.Clear
  222.      CondCombo.Visible = True
  223.      Label7.Visible = False
  224.      Label6.Caption = "The section will be printed:"
  225.      CondCombo.Text = "on any change"
  226.      Text4.Text = "an any change"
  227.      CondCombo.AddItem "on any change"
  228.      CondCombo.AddItem "on change to Yes"
  229.      CondCombo.AddItem "on change to No"
  230.      CondCombo.AddItem "on every Yes"
  231.      CondCombo.AddItem "on every No"
  232.      CondCombo.AddItem "on next is Yes"
  233.      CondCombo.AddItem "on next is No"
  234.    Else
  235.      CondCombo.Clear
  236.      CondCombo.Visible = False
  237.      Label6.Caption = "The section will be printed on Any Change Of:"
  238.      Label7.Caption = GroupCondCombo.Text
  239.      Label7.Visible = True
  240.      Text4.Visible = False
  241.    End If
  242.  End If
  243. End Sub
  244. Sub Form_Load ()
  245. 'Declare Variables
  246.  Dim I As Integer
  247.  Dim SectionCode1 As Integer
  248.  Dim GroupField As String
  249.  Dim ConditionFieldHandle As Integer
  250.  Dim ConditionFieldLength As Integer
  251.  Dim ConditionField As Integer
  252.  Dim GroupNumber As Integer
  253.  'Set Constants
  254.   GroupNumber = 1
  255. 'Check if jobnumber is open
  256. If Jobnum = 0 Then
  257.   MsgBox "No Job Open"
  258.   Exit Sub
  259. End If
  260. 'Get the Number of groups in Report
  261. NGroups = PEGetNGroups(Jobnum)
  262. 'Check to see if there are any groups to retrieve
  263. If NGroups = 0 Then
  264.   MsgBox "There are no groups in your report. You cannot modify group conditions unless you have previously defined groups in your report. You cannot add new group conditions at runtime!"
  265.   Exit Sub
  266. End If
  267. 'Populate label
  268. If NGroups = 1 Then
  269.  Label4.Caption = "Your report has " + Trim(Str(NGroups)) + " group. Group # " + Str(GroupNumber)
  270.   Label4.Caption = "Your report has " + Trim(Str(NGroups)) + " groups. Group # " + Str(GroupNumber) + ":"
  271. End If
  272. 'Populate Combo box for each Group condition in report
  273. 'The value that is retrieve is just the field name. The table name is not return so if the user wants
  274. 'to modify the condition they will have to enter the condition in this format: {table/file.fieldname}
  275. For I = 0 To NGroups - 1
  276.     SectionCode1 = 3000 + I
  277.     If PEGetGroupCondition(Jobnum, SectionCode1, ConditionFieldHandle, ConditionFieldLength, ConditionField, Sortdirection(I)) = False Then
  278.       RCode = GetErrorString(Jobnum)
  279.       MsgBox "PEGetGroupCondition Error #: " + Str(ErrorCode) + " - " + RCode
  280.     End If
  281.     GroupField = String(ConditionFieldLength, " ")
  282.     If PEGetHandleString(ConditionFieldHandle, GroupField, ConditionFieldLength) = False Then
  283.       RCode = GetErrorString(Jobnum)
  284.       MsgBox "PEGetHandleString Error #: " + Str(ErrorCode) + " - " + RCode
  285.     Else
  286.       'Conditionfield is return as a 2 byte integer value
  287.       'the upper byte is the TypeMask(i.e. Date, Boolean, other)
  288.        MYTYPE(I) = ConditionField And PE_GC_TYPEMASK
  289.       
  290.       'depending on what the typemask is then show the appropriate information in the field type combo
  291.       'and then display the condition combo box that allow the user
  292.       'to select the condition(i.e. on every yes - if boolean)
  293.        MYCONDITION(I) = ConditionField And PE_GC_CONDITIONMASK
  294.        
  295.       
  296.       'If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEDATE And MYCONDITION(GroupCondCombo.ListIndex) = 0 Then
  297.     '  FieldTypeCombo.Text = "Date"
  298.      ' CondCombo.Text = "for each day"
  299.       'All of the following nested if-then-else statements are not that complicated. Basically, I did
  300.       'this inorder to create "nice" user interface. These if statements simply check to see if the
  301.       'group field and then checks the sortdirection, Condition Type and Condition and populated the
  302.       'Combo box and overlying text boxes. This was done for aesthetic reasons. If I did not do this
  303.       'the combo box would not have a value in them when the form was loaded.
  304.       If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 0 Then
  305.         Text1.Text = GroupField
  306.         Text2.Text = "Ascending"
  307.         Text3.Text = "Date"
  308.         Text4.Text = "for each Day"
  309.         CondCombo.Visible = True
  310.         Text4.Visible = True
  311.         Label6.Caption = "The section will be printed:"
  312.         Scode = 3000
  313.         SortDir = Sortdirection(I)
  314.         Cond = MYCONDITION(I)
  315.       Else
  316.         If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 0 Then
  317.          Text1.Text = GroupField
  318.          Text2.Text = "Descending"
  319.          Text3.Text = "Date"
  320.          Text4.Text = "for each Day"
  321.          CondCombo.Visible = True
  322.          Text4.Visible = True
  323.          Label6.Caption = "The section will be printed:"
  324.          Scode = 3000
  325.          SortDir = Sortdirection(I)
  326.          Cond = MYCONDITION(I)
  327.         Else
  328.           If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 1 Then
  329.            Text1.Text = GroupField
  330.            Text2.Text = "Ascending"
  331.            Text3.Text = "Date"
  332.            Text4.Text = "for each Week"
  333.            CondCombo.Visible = True
  334.            Text4.Visible = True
  335.            Label6.Caption = "The section will be printed:"
  336.            Scode = 3000
  337.            SortDir = Sortdirection(I)
  338.            Cond = MYCONDITION(I)
  339.           Else
  340.            If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 1 Then
  341.             Text1.Text = GroupField
  342.             Text2.Text = "Descending"
  343.             Text3.Text = "Date"
  344.             Text4.Text = "for each Week"
  345.             CondCombo.Visible = True
  346.             Text4.Visible = True
  347.             Label6.Caption = "The section will be printed:"
  348.             Scode = 3000
  349.             SortDir = Sortdirection(I)
  350.             Cond = MYCONDITION(I)
  351.            Else
  352.              If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 2 Then
  353.                Text1.Text = GroupField
  354.                Text2.Text = "Ascending"
  355.                Text3.Text = "Date"
  356.                Text4.Text = "for each Two Weeks"
  357.                CondCombo.Visible = True
  358.                Text4.Visible = True
  359.                Label6.Caption = "The section will be printed:"
  360.                Scode = 3000
  361.                SortDir = Sortdirection(I)
  362.                Cond = MYCONDITION(I)
  363.              Else
  364.               If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 2 Then
  365.                 Text1.Text = GroupField
  366.                 Text2.Text = "Descending"
  367.                 Text3.Text = "Date"
  368.                 Text4.Text = "for each Two Weeks"
  369.                 CondCombo.Visible = True
  370.                 Text4.Visible = True
  371.                 Label6.Caption = "The section will be printed:"
  372.                 Scode = 3000
  373.                 SortDir = Sortdirection(I)
  374.                 Cond = MYCONDITION(I)
  375.               Else
  376.                 If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 3 Then
  377.                   Text1.Text = GroupField
  378.                   Text2.Text = "Ascending"
  379.                   Text3.Text = "Date"
  380.                   Text4.Text = "for each Half Month"
  381.                   CondCombo.Visible = True
  382.                   Text4.Visible = True
  383.                   Label6.Caption = "The section will be printed:"
  384.                   Scode = 3000
  385.                   SortDir = Sortdirection(I)
  386.                   Cond = MYCONDITION(I)
  387.                Else
  388.                  If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 3 Then
  389.                    Text1.Text = GroupField
  390.                    Text2.Text = "Descending"
  391.                    Text3.Text = "Date"
  392.                    Text4.Text = "for each Half Month"
  393.                    CondCombo.Visible = True
  394.                    Text4.Visible = True
  395.                    Label6.Caption = "The section will be printed:"
  396.                    Scode = 3000
  397.                    SortDir = Sortdirection(I)
  398.                    Cond = MYCONDITION(I)
  399.                  Else
  400.                    If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 4 Then
  401.                      Text1.Text = GroupField
  402.                      Text2.Text = "Ascending"
  403.                      Text3.Text = "Date"
  404.                      Text4.Text = "for each Month"
  405.                      CondCombo.Visible = True
  406.                      Text4.Visible = True
  407.                      Label6.Caption = "The section will be printed:"
  408.                      Scode = 3000
  409.                      SortDir = Sortdirection(I)
  410.                      Cond = MYCONDITION(I)
  411.                    Else
  412.                     If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 4 Then
  413.                       Text1.Text = GroupField
  414.                       Text2.Text = "Descending"
  415.                       Text3.Text = "Date"
  416.                       Text4.Text = "for each Month"
  417.                       CondCombo.Visible = True
  418.                       Text4.Visible = True
  419.                       Label6.Caption = "The section will be printed:"
  420.                       Scode = 3000
  421.                       SortDir = Sortdirection(I)
  422.                       Cond = MYCONDITION(I)
  423.                     Else
  424.                      If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 5 Then
  425.                        Text1.Text = GroupField
  426.                        Text2.Text = "Ascending"
  427.                        Text3.Text = "Date"
  428.                        Text4.Text = "for each Month"
  429.                        CondCombo.Visible = True
  430.                        Text4.Visible = True
  431.                        Label6.Caption = "The section will be printed:"
  432.                        Scode = 3000
  433.                        SortDir = Sortdirection(I)
  434.                        Cond = MYCONDITION(I)
  435.                      Else
  436.                       If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 5 Then
  437.                         Text1.Text = GroupField
  438.                         Text2.Text = "Descending"
  439.                         Text3.Text = "Date"
  440.                         Text4.Text = "for each Month"
  441.                         CondCombo.Visible = True
  442.                         Text4.Visible = True
  443.                         Label6.Caption = "The section will be printed:"
  444.                         Scode = 3000
  445.                         SortDir = Sortdirection(I)
  446.                         Cond = MYCONDITION(I)
  447.                       Else
  448.                        If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 6 Then
  449.                          Text1.Text = GroupField
  450.                          Text2.Text = "Ascending"
  451.                          Text3.Text = "Date"
  452.                          Text4.Text = "for each Quarter"
  453.                          CondCombo.Visible = True
  454.                          Text4.Visible = True
  455.                          Label6.Caption = "The section will be printed:"
  456.                          Scode = 3000
  457.                          SortDir = Sortdirection(I)
  458.                          Cond = MYCONDITION(I)
  459.                        Else
  460.                         If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 6 Then
  461.                           Text1.Text = GroupField
  462.                           Text2.Text = "Descending"
  463.                           Text3.Text = "Date"
  464.                           Text4.Text = "for each Quarter"
  465.                           CondCombo.Visible = True
  466.                           Text4.Visible = True
  467.                           Label6.Caption = "The section will be printed:"
  468.                           Scode = 3000
  469.                           SortDir = Sortdirection(I)
  470.                           Cond = MYCONDITION(I)
  471.                         Else
  472.                           If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 7 Then
  473.                             Text1.Text = GroupField
  474.                             Text2.Text = "Ascending"
  475.                             Text3.Text = "Date"
  476.                             Text4.Text = "for each Half Year"
  477.                             CondCombo.Visible = True
  478.                             Text4.Visible = True
  479.                             Label6.Caption = "The section will be printed:"
  480.                             Scode = 3000
  481.                             SortDir = Sortdirection(I)
  482.                             Cond = MYCONDITION(I)
  483.               
  484.                           Else
  485.                            If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 7 Then
  486.                              Text1.Text = GroupField
  487.                              Text2.Text = "Descending"
  488.                              Text3.Text = "Date"
  489.                              Text4.Text = "for each Half Year"
  490.                              CondCombo.Visible = True
  491.                              Text4.Visible = True
  492.                              Label6.Caption = "The section will be printed:"
  493.                              Scode = 3000
  494.                              SortDir = Sortdirection(I)
  495.                              Cond = MYCONDITION(I)
  496.                            Else
  497.                              If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 8 Then
  498.                                Text1.Text = GroupField
  499.                                Text2.Text = "Ascending"
  500.                                Text3.Text = "Date"
  501.                                Text4.Text = "for each Year"
  502.                                CondCombo.Visible = True
  503.                                Text4.Visible = True
  504.                                Label6.Caption = "The section will be printed:"
  505.                                Scode = 3000
  506.                                SortDir = Sortdirection(I)
  507.                                Cond = MYCONDITION(I)
  508.                              Else
  509.                               If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEDATE And MYCONDITION(I) = 8 Then
  510.                                 Text1.Text = GroupField
  511.                                 Text2.Text = "Descending"
  512.                                 Text3.Text = "Date"
  513.                                 Text4.Text = "for each Year"
  514.                                 CondCombo.Visible = True
  515.                                 Text4.Visible = True
  516.                                 Label6.Caption = "The section will be printed:"
  517.                                 Scode = 3000
  518.                                 SortDir = Sortdirection(I)
  519.                                 Cond = MYCONDITION(I)
  520.                               End If
  521.                              End If
  522.                            End If
  523.                           End If
  524.                         End If
  525.                        End If
  526.                       End If
  527.                      End If
  528.                     End If
  529.                    End If
  530.                  End If
  531.                End If
  532.               End If
  533.              End If
  534.            End If
  535.           End If
  536.         End If
  537.       End If
  538.     End If
  539.       If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEBOOLEAN And MYCONDITION(I) = 0 Then
  540.         Text1.Text = GroupField
  541.         Text2.Text = "Ascending"
  542.         Text3.Text = "Boolean"
  543.         Text4.Text = "on any change"
  544.         Scode = 3000
  545.         SortDir = Sortdirection(I)
  546.         Cond = MYCONDITION(I)
  547.       Else
  548.         If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEBOOLEAN And MYCONDITION(I) = 0 Then
  549.          Text1.Text = GroupField
  550.          Text2.Text = "Descending"
  551.          Text3.Text = "Boolean"
  552.          Text4.Text = "on any change"
  553.          Scode = 3000
  554.          SortDir = Sortdirection(I)
  555.          Cond = MYCONDITION(I)
  556.         Else
  557.           If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEBOOLEAN And MYCONDITION(I) = 1 Then
  558.            Text1.Text = GroupField
  559.            Text2.Text = "Ascending"
  560.            Text3.Text = "Boolean"
  561.            Text4.Text = "on change to yes"
  562.            Scode = 3000
  563.            SortDir = Sortdirection(I)
  564.            Cond = MYCONDITION(I)
  565.           Else
  566.            If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEBOOLEAN And MYCONDITION(I) = 1 Then
  567.             Text1.Text = GroupField
  568.             Text2.Text = "Descending"
  569.             Text3.Text = "Boolean"
  570.             Text4.Text = "on change to yes"
  571.             Scode = 3000
  572.             SortDir = Sortdirection(I)
  573.             Cond = MYCONDITION(I)
  574.            Else
  575.              If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEBOOLEAN And MYCONDITION(I) = 2 Then
  576.                Text1.Text = GroupField
  577.                Text2.Text = "Ascending"
  578.                Text3.Text = "Boolean"
  579.                Text4.Text = "on change to no"
  580.                Scode = 3000
  581.                SortDir = Sortdirection(I)
  582.                Cond = MYCONDITION(I)
  583.              Else
  584.               If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEBOOLEAN And MYCONDITION(I) = 2 Then
  585.                 Text1.Text = GroupField
  586.                 Text2.Text = "Descending"
  587.                 Text3.Text = "Boolean"
  588.                 Text4.Text = "on change to no"
  589.                 Scode = 3000
  590.                 SortDir = Sortdirection(I)
  591.                 Cond = MYCONDITION(I)
  592.               Else
  593.                If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEBOOLEAN And MYCONDITION(I) = 3 Then
  594.                   Text1.Text = GroupField
  595.                   Text2.Text = "Ascending"
  596.                   Text3.Text = "Boolean"
  597.                   Text4.Text = "on every yes"
  598.                   Scode = 3000
  599.                   SortDir = Sortdirection(I)
  600.                   Cond = MYCONDITION(I)
  601.                Else
  602.                  If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEBOOLEAN And MYCONDITION(I) = 3 Then
  603.                    Text1.Text = GroupField
  604.                    Text2.Text = "Descending"
  605.                    Text3.Text = "Boolean"
  606.                    Text4.Text = "on every yes"
  607.                    Scode = 3000
  608.                    SortDir = Sortdirection(I)
  609.                    Cond = MYCONDITION(I)
  610.                  Else
  611.                    If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEBOOLEAN And MYCONDITION(I) = 4 Then
  612.                      Text1.Text = GroupField
  613.                      Text2.Text = "Ascending"
  614.                      Text3.Text = "Boolean"
  615.                      Text4.Text = "on every no"
  616.                      Scode = 3000
  617.                      SortDir = Sortdirection(I)
  618.                      Cond = MYCONDITION(I)
  619.                    Else
  620.                     If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEBOOLEAN And MYCONDITION(I) = 4 Then
  621.                       Text1.Text = GroupField
  622.                       Text2.Text = "Descending"
  623.                       Text3.Text = "Boolean"
  624.                       Text4.Text = "on every no"
  625.                       Scode = 3000
  626.                       SortDir = Sortdirection(I)
  627.                       Cond = MYCONDITION(I)
  628.                     Else
  629.                      If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEBOOLEAN And MYCONDITION(I) = 5 Then
  630.                        Text1.Text = GroupField
  631.                        Text2.Text = "Ascending"
  632.                        Text3.Text = "Boolean"
  633.                        Text4.Text = "on next is yes"
  634.                        Scode = 3000
  635.                        SortDir = Sortdirection(I)
  636.                        Cond = MYCONDITION(I)
  637.                      Else
  638.                       If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEBOOLEAN And MYCONDITION(I) = 5 Then
  639.                         Text1.Text = GroupField
  640.                         Text2.Text = "Descending"
  641.                         Text3.Text = "Boolean"
  642.                         Text4.Text = "on next is yes"
  643.                         Scode = 3000
  644.                         SortDir = Sortdirection(I)
  645.                         Cond = MYCONDITION(I)
  646.                          
  647.                       Else
  648.                         If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEBOOLEAN And MYCONDITION(I) = 6 Then
  649.                           Text1.Text = GroupField
  650.                           Text2.Text = "Ascending"
  651.                           Text3.Text = "Boolean"
  652.                           Text4.Text = "on next is no"
  653.                           Scode = 3000
  654.                           SortDir = Sortdirection(I)
  655.                           Cond = MYCONDITION(I)
  656.                         Else
  657.                           If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEBOOLEAN And MYCONDITION(I) = 6 Then
  658.                           Text1.Text = GroupField
  659.                           Text2.Text = "Descending"
  660.                           Text3.Text = "Boolean"
  661.                           Text4.Text = "on next is no"
  662.                           Scode = 3000
  663.                           SortDir = Sortdirection(I)
  664.                           Cond = MYCONDITION(I)
  665.                         End If
  666.                       End If
  667.                           
  668.                         
  669.                         
  670.                       End If
  671.                      End If
  672.                     End If
  673.                    End If
  674.                  End If
  675.                 End If
  676.                End If
  677.               End If
  678.              End If
  679.            End If
  680.           End If
  681.         End If
  682.       
  683.      If I = 0 And Sortdirection(I) = 1 And MYTYPE(I) = PE_GC_TYPEOTHER And MYCONDITION(I) = PE_GC_ANYCHANGE Then
  684.       Text1.Text = GroupField
  685.       Text2.Text = "Ascending"
  686.       Text3.Text = "Other"
  687.       Label6.Caption = "The section will be printed on Any Change Of:"
  688.       Label7.Caption = GroupField
  689.       Label7.Visible = True
  690.       CondCombo.Visible = False
  691.       Text4.Visible = False
  692.       Scode = 3000
  693.       SortDir = Sortdirection(I)
  694.       Cond = MYCONDITION(I)
  695.       
  696.      Else
  697.       If I = 0 And Sortdirection(I) = 0 And MYTYPE(I) = PE_GC_TYPEOTHER And MYCONDITION(I) = PE_GC_ANYCHANGE Then
  698.         Text1.Text = GroupField
  699.         Text2.Text = "Descending"
  700.         Text3.Text = "Other"
  701.         Label6.Caption = "The section will be printed on Any Change Of:"
  702.         Label7.Caption = GroupField
  703.         Label7.Visible = True
  704.         CondCombo.Visible = False
  705.         Text4.Visible = False
  706.         Scode = 3000
  707.         SortDir = Sortdirection(I)
  708.         Cond = MYCONDITION(I)
  709.       End If
  710.      End If
  711.       GroupCondCombo.AddItem GroupField
  712.       
  713. Next I
  714. 'If the Type is a Date then populate the Condition Combo with the various Date Conditions
  715. If MYTYPE(0) = PE_GC_TYPEDATE Then
  716.   CondCombo.AddItem "for each Day"
  717.   CondCombo.AddItem "for each Week"
  718.   CondCombo.AddItem "for each Two Weeks"
  719.   CondCombo.AddItem "for each Half Month"
  720.   CondCombo.AddItem "for each Month"
  721.   CondCombo.AddItem "for each Quarter"
  722.   CondCombo.AddItem "for each Half Year"
  723.   CondCombo.AddItem "for each Half Year"
  724.   CondCombo.AddItem "for each Year"
  725. 'If the Type is a boolean then populate the Condition Combo with the various boolean Conditions
  726.   If MYTYPE(0) = PE_GC_TYPEBOOLEAN Then
  727.      CondCombo.AddItem "on any change"
  728.      CondCombo.AddItem "on change to Yes"
  729.      CondCombo.AddItem "on change to No"
  730.      CondCombo.AddItem "on every Yes"
  731.      CondCombo.AddItem "on every No"
  732.      CondCombo.AddItem "on next is Yes"
  733.      CondCombo.AddItem "on next is No"
  734.   End If
  735. End If
  736. 'Specify a Sortdirection for First element retrieved
  737. SortDir = Sortdirection(0)
  738. 'Populate Combo boxes
  739. SortDirCombo.AddItem "Ascending"
  740. SortDirCombo.AddItem "Descending"
  741. FieldTypeCombo.AddItem "Date"
  742. FieldTypeCombo.AddItem "Boolean"
  743. FieldTypeCombo.AddItem "Other"
  744. End Sub
  745. Sub GroupCondCombo_Click ()
  746.  Scode = 3000 + GroupCondCombo.ListIndex
  747.  GroupNumber = GroupCondCombo.ListIndex + 1
  748. If NGroups = 1 Then
  749.  Label4.Caption = "Your report has " + Trim(Str(NGroups)) + " group. Group # " + Str(GroupNumber)
  750.   Label4.Caption = "Your report has " + Trim(Str(NGroups)) + " groups. Group # " + Str(GroupNumber) + ":"
  751. End If
  752. If Sortdirection(GroupCondCombo.ListIndex) = 1 Then
  753.  SortDirCombo.Text = "Ascending"
  754.  SortDirCombo.Text = "Descending"
  755. End If
  756. If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEDATE And MYCONDITION(GroupCondCombo.ListIndex) = 0 Then
  757.   CondCombo.Clear
  758.   Text3.Text = "Date"
  759.   CondCombo.Text = "for each day"
  760.   CondCombo.AddItem "for each Day"
  761.   CondCombo.AddItem "for each Week"
  762.   CondCombo.AddItem "for each Two Weeks"
  763.   CondCombo.AddItem "for each Half Month"
  764.   CondCombo.AddItem "for each Month"
  765.   CondCombo.AddItem "for each Quarter"
  766.   CondCombo.AddItem "for each Half Year"
  767.   CondCombo.AddItem "for each Year"
  768.   Label6.Caption = "The section will be printed:"
  769.   Label7.Visible = False
  770.   CondCombo.Visible = True
  771.   Text4.Visible = True
  772.   If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEDATE And MYCONDITION(GroupCondCombo.ListIndex) = 1 Then
  773.     CondCombo.Clear
  774.     Text3.Text = "Date"
  775.     CondCombo.Text = "for each Week"
  776.     CondCombo.AddItem "for each Day"
  777.     CondCombo.AddItem "for each Week"
  778.     CondCombo.AddItem "for each Two Weeks"
  779.     CondCombo.AddItem "for each Half Month"
  780.     CondCombo.AddItem "for each Month"
  781.     CondCombo.AddItem "for each Quarter"
  782.     CondCombo.AddItem "for each Half Year"
  783.     CondCombo.AddItem "for each Year"
  784.     Label6.Caption = "The section will be printed:"
  785.     Label7.Visible = False
  786.     CondCombo.Visible = True
  787.     Text4.Visible = True
  788.   Else
  789.    If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEDATE And MYCONDITION(GroupCondCombo.ListIndex) = 2 Then
  790.      CondCombo.Clear
  791.      Text3.Text = "Date"
  792.      CondCombo.Text = "for each Two Weeks"
  793.      CondCombo.AddItem "for each Day"
  794.      CondCombo.AddItem "for each Week"
  795.      CondCombo.AddItem "for each Two Weeks"
  796.      CondCombo.AddItem "for each Half Month"
  797.      CondCombo.AddItem "for each Month"
  798.      CondCombo.AddItem "for each Quarter"
  799.      CondCombo.AddItem "for each Half Year"
  800.      CondCombo.AddItem "for each Year"
  801.      Label6.Caption = "The section will be printed:"
  802.      Label7.Visible = False
  803.      CondCombo.Visible = True
  804.      Text4.Visible = True
  805.    Else
  806.      If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEDATE And MYCONDITION(GroupCondCombo.ListIndex) = 3 Then
  807.        CondCombo.Clear
  808.        Text3.Text = "Date"
  809.        CondCombo.Text = "for each Half Month"
  810.        CondCombo.AddItem "for each Day"
  811.        CondCombo.AddItem "for each Week"
  812.        CondCombo.AddItem "for each Two Weeks"
  813.        CondCombo.AddItem "for each Half Month"
  814.        CondCombo.AddItem "for each Month"
  815.        CondCombo.AddItem "for each Quarter"
  816.        CondCombo.AddItem "for each Half Year"
  817.        CondCombo.AddItem "for each Year"
  818.        Label6.Caption = "The section will be printed:"
  819.        Label7.Visible = False
  820.        CondCombo.Visible = True
  821.        Text4.Visible = True
  822.      Else
  823.        If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEDATE And MYCONDITION(GroupCondCombo.ListIndex) = 4 Then
  824.          CondCombo.Clear
  825.          Text3.Text = "Date"
  826.          CondCombo.Text = "for each Month"
  827.          CondCombo.AddItem "for each Day"
  828.          CondCombo.AddItem "for each Week"
  829.          CondCombo.AddItem "for each Two Weeks"
  830.          CondCombo.AddItem "for each Half Month"
  831.          CondCombo.AddItem "for each Month"
  832.          CondCombo.AddItem "for each Quarter"
  833.          CondCombo.AddItem "for each Half Year"
  834.          CondCombo.AddItem "for each Year"
  835.          Label6.Caption = "The section will be printed:"
  836.          Label7.Visible = False
  837.          CondCombo.Visible = True
  838.          Text4.Visible = True
  839.        Else
  840.          If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEDATE And MYCONDITION(GroupCondCombo.ListIndex) = 5 Then
  841.            CondCombo.Clear
  842.            Text3.Text = "Date"
  843.            CondCombo.Text = "for each Quarter"
  844.            CondCombo.AddItem "for each Day"
  845.            CondCombo.AddItem "for each Week"
  846.            CondCombo.AddItem "for each Two Weeks"
  847.            CondCombo.AddItem "for each Half Month"
  848.            CondCombo.AddItem "for each Month"
  849.            CondCombo.AddItem "for each Quarter"
  850.            CondCombo.AddItem "for each Half Year"
  851.            CondCombo.AddItem "for each Year"
  852.            Label6.Caption = "The section will be printed:"
  853.            Label7.Visible = False
  854.            CondCombo.Visible = True
  855.            Text4.Visible = True
  856.          Else
  857.            If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEDATE And MYCONDITION(GroupCondCombo.ListIndex) = 6 Then
  858.               CondCombo.Clear
  859.               Text3.Text = "Date"
  860.               CondCombo.Text = "for each Half Year"
  861.               CondCombo.AddItem "for each Day"
  862.               CondCombo.AddItem "for each Week"
  863.               CondCombo.AddItem "for each Two Weeks"
  864.               CondCombo.AddItem "for each Half Month"
  865.               CondCombo.AddItem "for each Month"
  866.               CondCombo.AddItem "for each Quarter"
  867.               CondCombo.AddItem "for each Half Year"
  868.               CondCombo.AddItem "for each Year"
  869.               Label6.Caption = "The section will be printed:"
  870.               Label7.Visible = False
  871.               CondCombo.Visible = True
  872.               Text4.Visible = True
  873.            Else
  874.              If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEDATE And MYCONDITION(GroupCondCombo.ListIndex) = 0 Then
  875.                CondCombo.Clear
  876.                Text3.Text = "Date"
  877.                CondCombo.Text = "for each Year"
  878.                CondCombo.AddItem "for each Day"
  879.                CondCombo.AddItem "for each Week"
  880.                CondCombo.AddItem "for each Two Weeks"
  881.                CondCombo.AddItem "for each Half Month"
  882.                CondCombo.AddItem "for each Month"
  883.                CondCombo.AddItem "for each Quarter"
  884.                CondCombo.AddItem "for each Half Year"
  885.                CondCombo.AddItem "for each Year"
  886.                Label6.Caption = "The section will be printed:"
  887.                Label7.Visible = False
  888.                CondCombo.Visible = True
  889.                Text4.Visible = True
  890.              End If
  891.            End If
  892.          End If
  893.        End If
  894.      End If
  895.   End If
  896. End If
  897. End If
  898. If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEBOOLEAN And MYCONDITION(GroupCondCombo.ListIndex) = 0 Then
  899.   CondCombo.Clear
  900.   Text3.Text = "Boolean"
  901.   CondCombo.Text = "on any change"
  902.   CondCombo.AddItem "on any change"
  903.   CondCombo.AddItem "on change to Yes"
  904.   CondCombo.AddItem "on change to No"
  905.   CondCombo.AddItem "on every Yes"
  906.   CondCombo.AddItem "on every No"
  907.   CondCombo.AddItem "on next is Yes"
  908.   CondCombo.AddItem "on next is No"
  909.   Label6.Caption = "The section will be printed:"
  910.   Label7.Visible = False
  911.   CondCombo.Visible = True
  912.   Text4.Visible = True
  913.   If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEBOOLEAN And MYCONDITION(GroupCondCombo.ListIndex) = 1 Then
  914.     CondCombo.Clear
  915.     Text3.Text = "Boolean"
  916.     CondCombo.Text = "on change to Yes"
  917.     CondCombo.AddItem "on change to Yes"
  918.     CondCombo.AddItem "on change to No"
  919.     CondCombo.AddItem "on every Yes"
  920.     CondCombo.AddItem "on every No"
  921.     CondCombo.AddItem "on next is Yes"
  922.     CondCombo.AddItem "on next is No"
  923.     Label6.Caption = "The section will be printed:"
  924.     Label7.Visible = False
  925.     CondCombo.Visible = True
  926.     Text4.Visible = True
  927.        
  928.   Else
  929.    If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEBOOLEAN And MYCONDITION(GroupCondCombo.ListIndex) = 2 Then
  930.      CondCombo.Clear
  931.      Text3.Text = "Boolean"
  932.      CondCombo.Text = "on change to No"
  933.      CondCombo.AddItem "on change to Yes"
  934.      CondCombo.AddItem "on change to No"
  935.      CondCombo.AddItem "on every Yes"
  936.      CondCombo.AddItem "on every No"
  937.      CondCombo.AddItem "on next is Yes"
  938.      CondCombo.AddItem "on next is No"
  939.      Label6.Caption = "The section will be printed:"
  940.      Label7.Visible = False
  941.      CondCombo.Visible = True
  942.      Text4.Visible = True
  943.    Else
  944.      If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEBOOLEAN And MYCONDITION(GroupCondCombo.ListIndex) = 3 Then
  945.        CondCombo.Clear
  946.        Text3.Text = "Boolean"
  947.        CondCombo.Text = "on every Yes"
  948.        CondCombo.AddItem "on change to Yes"
  949.        CondCombo.AddItem "on change to No"
  950.        CondCombo.AddItem "on every Yes"
  951.        CondCombo.AddItem "on every No"
  952.        CondCombo.AddItem "on next is Yes"
  953.        CondCombo.AddItem "on next is No"
  954.        Label6.Caption = "The section will be printed:"
  955.        Label7.Visible = False
  956.        CondCombo.Visible = True
  957.        Text4.Visible = True
  958.      Else
  959.        If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEBOOLEAN And MYCONDITION(GroupCondCombo.ListIndex) = 4 Then
  960.          CondCombo.Clear
  961.          Text3.Text = "Boolean"
  962.          CondCombo.Text = "on every No"
  963.          CondCombo.AddItem "on change to Yes"
  964.          CondCombo.AddItem "on change to No"
  965.          CondCombo.AddItem "on every Yes"
  966.          CondCombo.AddItem "on every No"
  967.          CondCombo.AddItem "on next is Yes"
  968.          CondCombo.AddItem "on next is No"
  969.          Label6.Caption = "The section will be printed:"
  970.          Label7.Visible = False
  971.          CondCombo.Visible = True
  972.          Text4.Visible = True
  973.        Else
  974.          If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEBOOLEAN And MYCONDITION(GroupCondCombo.ListIndex) = 5 Then
  975.            CondCombo.Clear
  976.            Text3.Text = "Boolean"
  977.            CondCombo.Text = "on next is Yes"
  978.            CondCombo.AddItem "on change to Yes"
  979.            CondCombo.AddItem "on change to No"
  980.            CondCombo.AddItem "on every Yes"
  981.            CondCombo.AddItem "on every No"
  982.            CondCombo.AddItem "on next is Yes"
  983.            CondCombo.AddItem "on next is No"
  984.            Label6.Caption = "The section will be printed:"
  985.            Label7.Visible = False
  986.            CondCombo.Visible = True
  987.            Text4.Visible = True
  988.          Else
  989.            If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEBOOLEAN And MYCONDITION(GroupCondCombo.ListIndex) = 6 Then
  990.              CondCombo.Clear
  991.              Text3.Text = "Boolean"
  992.              CondCombo.Text = "on next is No"
  993.              CondCombo.AddItem "on change to Yes"
  994.              CondCombo.AddItem "on change to No"
  995.              CondCombo.AddItem "on every Yes"
  996.              CondCombo.AddItem "on every No"
  997.              CondCombo.AddItem "on next is Yes"
  998.              CondCombo.AddItem "on next is No"
  999.              Label6.Caption = "The section will be printed:"
  1000.              Label7.Visible = False
  1001.              CondCombo.Visible = True
  1002.              Text4.Visible = True
  1003.            End If
  1004.            
  1005.            
  1006.          End If
  1007.        End If
  1008.      End If
  1009.    End If
  1010.   End If
  1011. End If
  1012.          
  1013. If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEOTHER And MYCONDITION(GroupCondCombo.ListIndex) = PE_GC_ANYCHANGE Then
  1014.       Label6.Caption = "The section will be printed on Any Change Of:"
  1015.       Label7.Caption = GroupCondCombo.Text
  1016.       Label7.Visible = True
  1017.       CondCombo.Visible = False
  1018.       Text3.Text = "Other"
  1019.       Text4.Visible = False
  1020. End If
  1021. Text1.Text = GroupCondCombo.Text
  1022.      
  1023. 'Else
  1024.  ' If MYTYPE(GroupCondCombo.ListIndex) = PE_GC_TYPEBOOLEAN Then
  1025.   '  FieldTypeCombo.Text = "Boolean"
  1026.  ' Else
  1027.  '   FieldTypeCombo.Text = "Other"
  1028.  '' End If
  1029. 'End If
  1030. 'If MYCONDITION(GroupCondCombo.ListIndex) = '
  1031. End Sub
  1032. Sub Option3D1_Click (Index As Integer, Value As Integer)
  1033. End Sub
  1034. Sub Option3D4_Click (Index As Integer, Value As Integer)
  1035.    Command1.Visible = True
  1036.    'Specify Sortdirection of group section
  1037.    Select Case Index
  1038.     Case 0:
  1039.       SortDir = 1
  1040.     Case 1:
  1041.        SortDir = 0
  1042.    End Select
  1043. End Sub
  1044. Sub SortDirCombo_Change ()
  1045. Text2.Text = SortDirCombo.Text
  1046.   If SortDirCombo.Text = "Ascending" Then
  1047.     SortDir = 1
  1048.   Else
  1049.     SortDir = 0
  1050.   End If
  1051. End Sub
  1052. Sub SortDirCombo_Click ()
  1053.   If SortDirCombo.Text = "Ascending" Then
  1054.     SortDir = 1
  1055.   Else
  1056.     SortDir = 0
  1057.   End If
  1058. Text2.Text = SortDirCombo.Text
  1059. End Sub
  1060. Sub Text2_Change ()
  1061.   If Text2.Text = "Ascending" Then
  1062.     SortDir = 1
  1063.   Else
  1064.     SortDir = 0
  1065.   End If
  1066. End Sub
  1067.