home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / dbmsg / sql / vbsql / authors.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-04-03  |  56.2 KB  |  1,596 lines

  1. VERSION 2.00
  2. Begin Form fAuthors 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Authors"
  5.    ForeColor       =   &H00C0C0C0&
  6.    Height          =   5655
  7.    Icon            =   AUTHORS.FRX:0000
  8.    Left            =   270
  9.    LinkTopic       =   "Form1"
  10.    MDIChild        =   -1  'True
  11.    ScaleHeight     =   4965
  12.    ScaleWidth      =   9135
  13.    Top             =   1695
  14.    Width           =   9255
  15.    Begin SSFrame frmTitles 
  16.       Caption         =   "Titles"
  17.       FontBold        =   0   'False
  18.       FontItalic      =   0   'False
  19.       FontName        =   "MS Sans Serif"
  20.       FontSize        =   8.25
  21.       FontStrikethru  =   0   'False
  22.       FontUnderline   =   0   'False
  23.       ForeColor       =   &H00000000&
  24.       Height          =   2535
  25.       Left            =   75
  26.       TabIndex        =   41
  27.       Top             =   2325
  28.       Visible         =   0   'False
  29.       Width           =   8970
  30.       Begin SSPanel panGrid 
  31.          AutoSize        =   3  'AutoSize Child To Panel
  32.          BackColor       =   &H00C0C0C0&
  33.          BevelInner      =   1  'Inset
  34.          BevelOuter      =   0  'None
  35.          BorderWidth     =   0
  36.          ForeColor       =   &H00000000&
  37.          Height          =   2055
  38.          Left            =   120
  39.          TabIndex        =   42
  40.          Top             =   330
  41.          Width           =   8730
  42.          Begin Grid grdTitles 
  43.             Cols            =   9
  44.             FixedCols       =   0
  45.             FontBold        =   0   'False
  46.             FontItalic      =   0   'False
  47.             FontName        =   "MS Sans Serif"
  48.             FontSize        =   8.25
  49.             FontStrikethru  =   0   'False
  50.             FontUnderline   =   0   'False
  51.             Height          =   2025
  52.             Left            =   15
  53.             Rows            =   10
  54.             TabIndex        =   43
  55.             Top             =   15
  56.             Width           =   8700
  57.          End
  58.       End
  59.    End
  60.    Begin SSRibbon cmdDown 
  61.       AutoSize        =   0  'None
  62.       BackColor       =   &H00C0C0C0&
  63.       BevelWidth      =   1
  64.       Height          =   420
  65.       Left            =   8670
  66.       PictureUp       =   AUTHORS.FRX:0302
  67.       Top             =   75
  68.       Width           =   420
  69.    End
  70.    Begin SSPanel Panel3D9 
  71.       AutoSize        =   3  'AutoSize Child To Panel
  72.       BackColor       =   &H00C0C0C0&
  73.       BevelInner      =   1  'Inset
  74.       BevelOuter      =   0  'None
  75.       BorderWidth     =   0
  76.       ForeColor       =   &H00000000&
  77.       Height          =   375
  78.       Left            =   75
  79.       TabIndex        =   38
  80.       Top             =   1530
  81.       Width           =   2625
  82.       Begin SSCommand cmdMoreRows 
  83.          BevelWidth      =   1
  84.          Caption         =   "&More rows"
  85.          Enabled         =   0   'False
  86.          FontBold        =   0   'False
  87.          FontItalic      =   0   'False
  88.          FontName        =   "MS Sans Serif"
  89.          FontSize        =   8.25
  90.          FontStrikethru  =   0   'False
  91.          FontUnderline   =   0   'False
  92.          ForeColor       =   &H00000000&
  93.          Height          =   345
  94.          Left            =   15
  95.          TabIndex        =   39
  96.          Top             =   15
  97.          Width           =   2595
  98.       End
  99.    End
  100.    Begin SSPanel Panel3D1 
  101.       Alignment       =   8  'Center - BOTTOM
  102.       BackColor       =   &H00C0C0C0&
  103.       BevelInner      =   1  'Inset
  104.       BevelOuter      =   0  'None
  105.       BorderWidth     =   0
  106.       ForeColor       =   &H00000000&
  107.       Height          =   2190
  108.       Left            =   2775
  109.       TabIndex        =   29
  110.       Top             =   75
  111.       Width           =   5850
  112.       Begin SSPanel panAuthors 
  113.          AutoSize        =   3  'AutoSize Child To Panel
  114.          BackColor       =   &H00C0C0C0&
  115.          BevelInner      =   1  'Inset
  116.          BevelOuter      =   0  'None
  117.          BorderWidth     =   0
  118.          ForeColor       =   &H00000000&
  119.          Height          =   315
  120.          Index           =   1
  121.          Left            =   105
  122.          TabIndex        =   37
  123.          Top             =   315
  124.          Width           =   1140
  125.          Begin TextBox txtAuthors 
  126.             FontBold        =   0   'False
  127.             FontItalic      =   0   'False
  128.             FontName        =   "MS Sans Serif"
  129.             FontSize        =   8.25
  130.             FontStrikethru  =   0   'False
  131.             FontUnderline   =   0   'False
  132.             Height          =   285
  133.             Index           =   1
  134.             Left            =   15
  135.             TabIndex        =   1
  136.             Top             =   15
  137.             Width           =   1110
  138.          End
  139.       End
  140.       Begin SSPanel Panel3D8 
  141.          AutoSize        =   3  'AutoSize Child To Panel
  142.          BackColor       =   &H00C0C0C0&
  143.          BevelInner      =   1  'Inset
  144.          BevelOuter      =   0  'None
  145.          BorderWidth     =   0
  146.          ForeColor       =   &H00000000&
  147.          Height          =   315
  148.          Left            =   3450
  149.          TabIndex        =   36
  150.          Top             =   1020
  151.          Width           =   1695
  152.          Begin TextBox txtAuthors 
  153.             FontBold        =   0   'False
  154.             FontItalic      =   0   'False
  155.             FontName        =   "MS Sans Serif"
  156.             FontSize        =   8.25
  157.             FontStrikethru  =   0   'False
  158.             FontUnderline   =   0   'False
  159.             Height          =   285
  160.             Index           =   6
  161.             Left            =   15
  162.             TabIndex        =   6
  163.             Top             =   15
  164.             Width           =   1665
  165.          End
  166.       End
  167.       Begin SSPanel Panel3D2 
  168.          AutoSize        =   3  'AutoSize Child To Panel
  169.          BackColor       =   &H00C0C0C0&
  170.          BevelInner      =   1  'Inset
  171.          BevelOuter      =   0  'None
  172.          BorderWidth     =   0
  173.          ForeColor       =   &H00000000&
  174.          Height          =   315
  175.          Left            =   5190
  176.          TabIndex        =   35
  177.          Top             =   1020
  178.          Width           =   570
  179.          Begin TextBox txtAuthors 
  180.             FontBold        =   0   'False
  181.             FontItalic      =   0   'False
  182.             FontName        =   "MS Sans Serif"
  183.             FontSize        =   8.25
  184.             FontStrikethru  =   0   'False
  185.             FontUnderline   =   0   'False
  186.             Height          =   285
  187.             Index           =   7
  188.             Left            =   15
  189.             TabIndex        =   7
  190.             Top             =   15
  191.             Width           =   540
  192.          End
  193.       End
  194.       Begin SSPanel Panel3D3 
  195.          AutoSize        =   3  'AutoSize Child To Panel
  196.          BackColor       =   &H00C0C0C0&
  197.          BevelInner      =   1  'Inset
  198.          BevelOuter      =   0  'None
  199.          BorderWidth     =   0
  200.          ForeColor       =   &H00000000&
  201.          Height          =   315
  202.          Left            =   2235
  203.          TabIndex        =   34
  204.          Top             =   1020
  205.          Width           =   1170
  206.          Begin TextBox txtAuthors 
  207.             FontBold        =   0   'False
  208.             FontItalic      =   0   'False
  209.             FontName        =   "MS Sans Serif"
  210.             FontSize        =   8.25
  211.             FontStrikethru  =   0   'False
  212.             FontUnderline   =   0   'False
  213.             Height          =   285
  214.             Index           =   5
  215.             Left            =   15
  216.             TabIndex        =   5
  217.             Top             =   15
  218.             Width           =   1140
  219.          End
  220.       End
  221.       Begin SSPanel Panel3D4 
  222.          AutoSize        =   3  'AutoSize Child To Panel
  223.          BackColor       =   &H00C0C0C0&
  224.          BevelInner      =   1  'Inset
  225.          BevelOuter      =   0  'None
  226.          BorderWidth     =   0
  227.          ForeColor       =   &H00000000&
  228.          Height          =   315
  229.          Left            =   90
  230.          TabIndex        =   33
  231.          Top             =   1020
  232.          Width           =   2100
  233.          Begin TextBox txtAuthors 
  234.             FontBold        =   0   'False
  235.             FontItalic      =   0   'False
  236.             FontName        =   "MS Sans Serif"
  237.             FontSize        =   8.25
  238.             FontStrikethru  =   0   'False
  239.             FontUnderline   =   0   'False
  240.             Height          =   285
  241.             Index           =   4
  242.             Left            =   15
  243.             TabIndex        =   4
  244.             Top             =   15
  245.             Width           =   2070
  246.          End
  247.       End
  248.       Begin SSPanel Panel3D5 
  249.          AutoSize        =   3  'AutoSize Child To Panel
  250.          BackColor       =   &H00C0C0C0&
  251.          BevelInner      =   1  'Inset
  252.          BevelOuter      =   0  'None
  253.          BorderWidth     =   0
  254.          ForeColor       =   &H00000000&
  255.          Height          =   315
  256.          Left            =   3180
  257.          TabIndex        =   32
  258.          Top             =   315
  259.          Width           =   2580
  260.          Begin TextBox txtAuthors 
  261.             FontBold        =   0   'False
  262.             FontItalic      =   0   'False
  263.             FontName        =   "MS Sans Serif"
  264.             FontSize        =   8.25
  265.             FontStrikethru  =   0   'False
  266.             FontUnderline   =   0   'False
  267.             Height          =   285
  268.             Index           =   3
  269.             Left            =   15
  270.             TabIndex        =   3
  271.             Top             =   15
  272.             Width           =   2550
  273.          End
  274.       End
  275.       Begin SSPanel Panel3D6 
  276.          AutoSize        =   3  'AutoSize Child To Panel
  277.          BackColor       =   &H00C0C0C0&
  278.          BevelInner      =   1  'Inset
  279.          BevelOuter      =   0  'None
  280.          BorderWidth     =   0
  281.          ForeColor       =   &H00000000&
  282.          Height          =   315
  283.          Left            =   1290
  284.          TabIndex        =   31
  285.          Top             =   315
  286.          Width           =   1845
  287.          Begin TextBox txtAuthors 
  288.             FontBold        =   0   'False
  289.             FontItalic      =   0   'False
  290.             FontName        =   "MS Sans Serif"
  291.             FontSize        =   8.25
  292.             FontStrikethru  =   0   'False
  293.             FontUnderline   =   0   'False
  294.             Height          =   285
  295.             Index           =   2
  296.             Left            =   15
  297.             TabIndex        =   2
  298.             Top             =   15
  299.             Width           =   1815
  300.          End
  301.       End
  302.       Begin SSPanel Panel3D7 
  303.          AutoSize        =   3  'AutoSize Child To Panel
  304.          BackColor       =   &H00C0C0C0&
  305.          BevelInner      =   1  'Inset
  306.          BevelOuter      =   0  'None
  307.          BorderWidth     =   0
  308.          ForeColor       =   &H00000000&
  309.          Height          =   315
  310.          Left            =   105
  311.          TabIndex        =   30
  312.          Top             =   1695
  313.          Width           =   1635
  314.          Begin TextBox txtAuthors 
  315.             FontBold        =   0   'False
  316.             FontItalic      =   0   'False
  317.             FontName        =   "MS Sans Serif"
  318.             FontSize        =   8.25
  319.             FontStrikethru  =   0   'False
  320.             FontUnderline   =   0   'False
  321.             Height          =   285
  322.             Index           =   8
  323.             Left            =   15
  324.             TabIndex        =   8
  325.             Top             =   15
  326.             Width           =   1605
  327.          End
  328.       End
  329.       Begin SSCheck chkContract 
  330.          Caption         =   "Contract"
  331.          FontBold        =   0   'False
  332.          FontItalic      =   0   'False
  333.          FontName        =   "MS Sans Serif"
  334.          FontSize        =   8.25
  335.          FontStrikethru  =   0   'False
  336.          FontUnderline   =   0   'False
  337.          ForeColor       =   &H00000000&
  338.          Height          =   240
  339.          Left            =   2235
  340.          TabIndex        =   9
  341.          Top             =   1725
  342.          Width           =   930
  343.       End
  344.       Begin Label lblAuthors 
  345.          BackColor       =   &H00C0C0C0&
  346.          Caption         =   "Id"
  347.          FontBold        =   0   'False
  348.          FontItalic      =   0   'False
  349.          FontName        =   "MS Sans Serif"
  350.          FontSize        =   8.25
  351.          FontStrikethru  =   0   'False
  352.          FontUnderline   =   0   'False
  353.          Height          =   195
  354.          Index           =   1
  355.          Left            =   120
  356.          TabIndex        =   10
  357.          Top             =   120
  358.          Width           =   150
  359.       End
  360.       Begin Label lblAuthors 
  361.          BackColor       =   &H00C0C0C0&
  362.          Caption         =   "First"
  363.          FontBold        =   0   'False
  364.          FontItalic      =   0   'False
  365.          FontName        =   "MS Sans Serif"
  366.          FontSize        =   8.25
  367.          FontStrikethru  =   0   'False
  368.          FontUnderline   =   0   'False
  369.          Height          =   195
  370.          Index           =   2
  371.          Left            =   1320
  372.          TabIndex        =   11
  373.          Top             =   120
  374.          Width           =   285
  375.       End
  376.       Begin Label lblAuthors 
  377.          BackColor       =   &H00C0C0C0&
  378.          Caption         =   "Last"
  379.          FontBold        =   0   'False
  380.          FontItalic      =   0   'False
  381.          FontName        =   "MS Sans Serif"
  382.          FontSize        =   8.25
  383.          FontStrikethru  =   0   'False
  384.          FontUnderline   =   0   'False
  385.          Height          =   195
  386.          Index           =   3
  387.          Left            =   3195
  388.          TabIndex        =   12
  389.          Top             =   120
  390.          Width           =   300
  391.       End
  392.       Begin Label lblAuthors 
  393.          BackColor       =   &H00C0C0C0&
  394.          Caption         =   "Address"
  395.          FontBold        =   0   'False
  396.          FontItalic      =   0   'False
  397.          FontName        =   "MS Sans Serif"
  398.          FontSize        =   8.25
  399.          FontStrikethru  =   0   'False
  400.          FontUnderline   =   0   'False
  401.          Height          =   195
  402.          Index           =   4
  403.          Left            =   120
  404.          TabIndex        =   13
  405.          Top             =   825
  406.          Width           =   570
  407.       End
  408.       Begin Label lblAuthors 
  409.          BackColor       =   &H00C0C0C0&
  410.          Caption         =   "Zip Code"
  411.          FontBold        =   0   'False
  412.          FontItalic      =   0   'False
  413.          FontName        =   "MS Sans Serif"
  414.          FontSize        =   8.25
  415.          FontStrikethru  =   0   'False
  416.          FontUnderline   =   0   'False
  417.          Height          =   195
  418.          Index           =   5
  419.          Left            =   2295
  420.          TabIndex        =   14
  421.          Top             =   825
  422.          Width           =   645
  423.       End
  424.       Begin Label lblAuthors 
  425.          BackColor       =   &H00C0C0C0&
  426.          Caption         =   "City"
  427.          FontBold        =   0   'False
  428.          FontItalic      =   0   'False
  429.          FontName        =   "MS Sans Serif"
  430.          FontSize        =   8.25
  431.          FontStrikethru  =   0   'False
  432.          FontUnderline   =   0   'False
  433.          Height          =   195
  434.          Index           =   6
  435.          Left            =   3480
  436.          TabIndex        =   15
  437.          Top             =   825
  438.          Width           =   270
  439.       End
  440.       Begin Label lblAuthors 
  441.          BackColor       =   &H00C0C0C0&
  442.          Caption         =   "State"
  443.          FontBold        =   0   'False
  444.          FontItalic      =   0   'False
  445.          FontName        =   "MS Sans Serif"
  446.          FontSize        =   8.25
  447.          FontStrikethru  =   0   'False
  448.          FontUnderline   =   0   'False
  449.          Height          =   195
  450.          Index           =   7
  451.          Left            =   5205
  452.          TabIndex        =   16
  453.          Top             =   825
  454.          Width           =   375
  455.       End
  456.       Begin Label lblAuthors 
  457.          BackColor       =   &H00C0C0C0&
  458.          Caption         =   "Phone"
  459.          FontBold        =   0   'False
  460.          FontItalic      =   0   'False
  461.          FontName        =   "MS Sans Serif"
  462.          FontSize        =   8.25
  463.          FontStrikethru  =   0   'False
  464.          FontUnderline   =   0   'False
  465.          Height          =   195
  466.          Index           =   8
  467.          Left            =   120
  468.          TabIndex        =   17
  469.          Top             =   1500
  470.          Width           =   465
  471.       End
  472.    End
  473.    Begin SSPanel panItemsRemoved 
  474.       Alignment       =   8  'Center - BOTTOM
  475.       BackColor       =   &H00C0C0C0&
  476.       BevelInner      =   1  'Inset
  477.       BevelOuter      =   0  'None
  478.       BorderWidth     =   0
  479.       FontBold        =   0   'False
  480.       FontItalic      =   0   'False
  481.       FontName        =   "MS Sans Serif"
  482.       FontSize        =   8.25
  483.       FontStrikethru  =   0   'False
  484.       FontUnderline   =   0   'False
  485.       ForeColor       =   &H00000000&
  486.       Height          =   300
  487.       Left            =   75
  488.       TabIndex        =   28
  489.       Top             =   75
  490.       Width           =   2625
  491.    End
  492.    Begin SSPanel panItemsRead 
  493.       Alignment       =   8  'Center - BOTTOM
  494.       BackColor       =   &H00C0C0C0&
  495.       BevelInner      =   1  'Inset
  496.       BevelOuter      =   0  'None
  497.       BorderWidth     =   0
  498.       FontBold        =   0   'False
  499.       FontItalic      =   0   'False
  500.       FontName        =   "MS Sans Serif"
  501.       FontSize        =   8.25
  502.       FontStrikethru  =   0   'False
  503.       FontUnderline   =   0   'False
  504.       ForeColor       =   &H00000000&
  505.       Height          =   300
  506.       Left            =   75
  507.       TabIndex        =   27
  508.       Top             =   1965
  509.       Width           =   2625
  510.    End
  511.    Begin SSPanel panAuthors 
  512.       AutoSize        =   3  'AutoSize Child To Panel
  513.       BackColor       =   &H00C0C0C0&
  514.       BevelInner      =   1  'Inset
  515.       BevelOuter      =   0  'None
  516.       BorderWidth     =   0
  517.       ForeColor       =   &H00000000&
  518.       Height          =   1035
  519.       Index           =   0
  520.       Left            =   75
  521.       TabIndex        =   26
  522.       Top             =   450
  523.       Width           =   2625
  524.       Begin ListBox lstPrim 
  525.          FontBold        =   0   'False
  526.          FontItalic      =   0   'False
  527.          FontName        =   "MS Sans Serif"
  528.          FontSize        =   8.25
  529.          FontStrikethru  =   0   'False
  530.          FontUnderline   =   0   'False
  531.          Height          =   1005
  532.          Left            =   15
  533.          TabIndex        =   0
  534.          Top             =   15
  535.          Width           =   2595
  536.       End
  537.    End
  538.    Begin Frame Frame1 
  539.       BackColor       =   &H00C0C0C0&
  540.       Caption         =   "Invisibles"
  541.       FontBold        =   0   'False
  542.       FontItalic      =   0   'False
  543.       FontName        =   "MS Sans Serif"
  544.       FontSize        =   8.25
  545.       FontStrikethru  =   0   'False
  546.       FontUnderline   =   0   'False
  547.       Height          =   825
  548.       Left            =   9300
  549.       TabIndex        =   18
  550.       Top             =   555
  551.       Visible         =   0   'False
  552.       Width           =   5700
  553.       Begin SSCommand cmdSubGridDetail 
  554.          Caption         =   "SubGridDetail"
  555.          Font3D          =   1  'Raised w/light shading
  556.          FontBold        =   0   'False
  557.          FontItalic      =   0   'False
  558.          FontName        =   "MS Sans Serif"
  559.          FontSize        =   8.25
  560.          FontStrikethru  =   0   'False
  561.          FontUnderline   =   0   'False
  562.          ForeColor       =   &H00000000&
  563.          Height          =   495
  564.          Left            =   3570
  565.          TabIndex        =   40
  566.          Top             =   240
  567.          Visible         =   0   'False
  568.          Width           =   1215
  569.       End
  570.       Begin SSCommand MainButton 
  571.          BevelWidth      =   1
  572.          Font3D          =   1  'Raised w/light shading
  573.          ForeColor       =   &H00000000&
  574.          Height          =   345
  575.          Index           =   7
  576.          Left            =   2850
  577.          Picture         =   AUTHORS.FRX:049C
  578.          TabIndex        =   25
  579.          Top             =   300
  580.          Width           =   345
  581.       End
  582.       Begin SSCommand MainButton 
  583.          BevelWidth      =   1
  584.          Font3D          =   1  'Raised w/light shading
  585.          ForeColor       =   &H00000000&
  586.          Height          =   345
  587.          Index           =   6
  588.          Left            =   2325
  589.          Picture         =   AUTHORS.FRX:0636
  590.          TabIndex        =   24
  591.          Top             =   300
  592.          Width           =   345
  593.       End
  594.       Begin SSCommand MainButton 
  595.          BevelWidth      =   1
  596.          Font3D          =   1  'Raised w/light shading
  597.          ForeColor       =   &H00000000&
  598.          Height          =   345
  599.          Index           =   5
  600.          Left            =   1935
  601.          Picture         =   AUTHORS.FRX:07A0
  602.          TabIndex        =   23
  603.          Top             =   300
  604.          Width           =   345
  605.       End
  606.       Begin SSCommand MainButton 
  607.          BevelWidth      =   1
  608.          Font3D          =   1  'Raised w/light shading
  609.          ForeColor       =   &H00000000&
  610.          Height          =   345
  611.          Index           =   4
  612.          Left            =   1410
  613.          Picture         =   AUTHORS.FRX:093A
  614.          TabIndex        =   22
  615.          Top             =   300
  616.          Width           =   345
  617.       End
  618.       Begin SSCommand MainButton 
  619.          BevelWidth      =   1
  620.          Font3D          =   1  'Raised w/light shading
  621.          ForeColor       =   &H00000000&
  622.          Height          =   345
  623.          Index           =   3
  624.          Left            =   885
  625.          Picture         =   AUTHORS.FRX:0AA4
  626.          TabIndex        =   21
  627.          Top             =   300
  628.          Width           =   345
  629.       End
  630.       Begin SSCommand MainButton 
  631.          BevelWidth      =   1
  632.          Enabled         =   0   'False
  633.          Font3D          =   1  'Raised w/light shading
  634.          ForeColor       =   &H00000000&
  635.          Height          =   345
  636.          Index           =   2
  637.          Left            =   495
  638.          Picture         =   AUTHORS.FRX:0C0E
  639.          TabIndex        =   20
  640.          Top             =   300
  641.          Width           =   345
  642.       End
  643.       Begin SSCommand MainButton 
  644.          BevelWidth      =   1
  645.          Font3D          =   1  'Raised w/light shading
  646.          ForeColor       =   &H00000000&
  647.          Height          =   345
  648.          Index           =   1
  649.          Left            =   105
  650.          Picture         =   AUTHORS.FRX:0D78
  651.          TabIndex        =   19
  652.          Top             =   300
  653.          Width           =   345
  654.       End
  655.    End
  656.    Begin Menu menFile 
  657.       Caption         =   "&File"
  658.       Begin Menu altClose 
  659.          Caption         =   "&Close Form"
  660.       End
  661.       Begin Menu altDummy1 
  662.          Caption         =   "-"
  663.       End
  664.       Begin Menu altExit 
  665.          Caption         =   "&Exit"
  666.       End
  667.    End
  668.    Begin Menu menEdit 
  669.       Caption         =   "&Edit"
  670.       Begin Menu altNew 
  671.          Caption         =   "&New"
  672.          Shortcut        =   ^N
  673.       End
  674.       Begin Menu altSave 
  675.          Caption         =   "&Save"
  676.          Shortcut        =   ^S
  677.       End
  678.       Begin Menu altDelete 
  679.          Caption         =   "&Delete"
  680.       End
  681.       Begin Menu altClear 
  682.          Caption         =   "Clear &Form"
  683.          Shortcut        =   ^C
  684.       End
  685.       Begin Menu altRefresh 
  686.          Caption         =   "&Refresh"
  687.          Shortcut        =   ^R
  688.       End
  689.       Begin Menu altQuery 
  690.          Caption         =   "&Query"
  691.          Shortcut        =   ^Q
  692.       End
  693.       Begin Menu altCancel 
  694.          Caption         =   "&Cancel"
  695.       End
  696.       Begin Menu altDummy2 
  697.          Caption         =   "-"
  698.       End
  699.       Begin Menu altCopy 
  700.          Caption         =   "Copy &to new"
  701.       End
  702.       Begin Menu altRelease 
  703.          Caption         =   "&Release"
  704.       End
  705.    End
  706.    Begin Menu menForms 
  707.       Caption         =   "Fo&rms"
  708.       Begin Menu altAuthors 
  709.          Caption         =   "&Authors"
  710.          Shortcut        =   ^A
  711.       End
  712.    End
  713.    Begin Menu menWindow 
  714.       Caption         =   "&Window"
  715.       WindowList      =   -1  'True
  716.       Begin Menu altCascade 
  717.          Caption         =   "&Cascade"
  718.       End
  719.       Begin Menu altTile 
  720.          Caption         =   "&Tile"
  721.       End
  722.       Begin Menu altArrangeIcons 
  723.          Caption         =   "&Arrange Icons"
  724.       End
  725.       Begin Menu altDummy4 
  726.          Caption         =   "-"
  727.       End
  728.       Begin Menu altNormalSize 
  729.          Caption         =   "&Normal Size"
  730.       End
  731.    End
  732.    Begin Menu menSettings 
  733.       Caption         =   "&Options"
  734.       Begin Menu altShowSQL 
  735.          Caption         =   "&Show SQL"
  736.       End
  737.    End
  738.    Begin Menu menHelp 
  739.       Caption         =   "&Help"
  740.       Begin Menu altContents 
  741.          Caption         =   "&Contents"
  742.       End
  743.       Begin Menu altDummy3 
  744.          Caption         =   "-"
  745.       End
  746.       Begin Menu altAbout 
  747.          Caption         =   "&About..."
  748.       End
  749.    End
  750. ' The AUTHORS form
  751. ' =================
  752. ' Used for maintenance of information on authors
  753. ' including selecting, inserting, updating and deleting
  754. ' authors
  755. ' Constant definitions:
  756. ' --------------------
  757. ' The nominal Width and Height of the form are saved
  758. ' as constants to allow the form to be properly opened
  759. ' as a MDI Child and to regain its normal size when
  760. ' that option is chosen in the menu system (Window -
  761. ' Normal Size):
  762. Const DEFWIDTH% = 9255
  763. Const DEFMINHEIGHT% = 3060 - 280
  764. Const DEFMAXHEIGHT% = 5650 - 280
  765. ' The value of the constant CHUNKSIZE% determins the number of
  766. ' rows that will be read from the result set
  767. ' per chunk and added to the listbox.
  768. ' The value of the constant LSTPRIMMAX% is the max number of
  769. ' rows that will be held in the listbox lstPrim. When the
  770. ' number has been exeeded the application will start to remove
  771. ' the top row for each new row added to the listbox.
  772. ' NOTE! Both of these constants are indeed changeble to match
  773. ' your specific needs and thoughts.
  774. Const CHUNKSIZE% = 100
  775. Const LSTPRIMMAX% = 500
  776. ' The list box shows authors names. To help locate an
  777. ' author whose name is selected in the list box his or
  778. ' her AU_ID is also stored in the list box invisible
  779. ' to the user. The LISTWIDTH constant is used to determine
  780. ' exactly where in the list box text string the AU_ID is
  781. ' stored. It begins on the position of LISTWIDTH + 1 (71):
  782. Const LISTWIDTH% = 70
  783. ' Declare variables for a select channel and an update
  784. ' channel to SQL Server, known all over but not outside
  785. ' the form:
  786. Dim SelChannel As Integer
  787. Dim UpdChannel As Integer
  788. ' Declare a variable to store the last used Where clause.
  789. ' This allows a refresh operation, sending the same SQL
  790. ' select clause once again to the server using the refresh
  791. ' tool (shower) in the tool bar:
  792. Dim LastWhereClause As String
  793. ' Declare a MODE variable to store the different modes
  794. ' of the form. Mode could take up either of the following
  795. ' values: SQLNEW, SQLSHOW or SQLREST. Those values are
  796. ' declared as symbolic constants in the module ADBGLOB.BAS.
  797. ' SQLNEW is the mode when a new author is being entered.
  798. ' SQLSHOW is the mode when an existing author is shown
  799. ' in the form for possible modification or deletion.
  800. ' SQLREST is the mode when the form is resting, i.e. when
  801. ' a selection is being made or when the form is waiting for
  802. ' examples to use for QBE.
  803. Dim Mode As Integer
  804. ' The variable QualString save the qualification string
  805. ' returned from the call to SQLQUAL(). It containts references
  806. ' to the unique key and to the timestamp column.
  807. ' This is essential for Browse Mode.
  808. Dim QualString As String
  809. ' The variable FormMaxOpen is TRUE if the subgrid is showned.
  810. ' The user brings it up by clicking on the push button for
  811. ' titles. To close the subgrid just click on the push button
  812. ' again and FormMaxOpen will be set to FALSE.
  813. Dim FormMaxOpen As Integer
  814. Sub altAbout_Click ()
  815. ' Show the about box
  816.     fAbout.Show MODAL
  817. End Sub
  818. Sub altArrangeIcons_Click ()
  819. ' Arrange the icons of the MDI application
  820.     MDIMA.Arrange ARRANGE_ICONS
  821. End Sub
  822. Sub altAuthors_click ()
  823. ' Show another instance of the authors form
  824. ' Try opening several instances showing different
  825. ' sets of authors in each separate form, for instance
  826. ' Utah authors in one form and Michigan authors in
  827. ' another. Tile the forms for better overview.
  828. ' Declare a new instance of the Authors form:
  829. Dim newAuthors As New fAuthors
  830.     ' Open the new instance:
  831.     screen.MousePointer = 11
  832.     newAuthors.Show
  833.     screen.MousePointer = 0
  834. End Sub
  835. Sub altCancel_Click ()
  836. ' Cancels the ongoing operation; for instance modification
  837. ' of data about an author. If there is any operation
  838. ' to cancel, the cancel push button (with the X, like
  839. ' in Excel) will be enabled and then automatically pushed.
  840. ' If it is not enable there will be a beep:
  841.     If MainButton(7).Enabled Then
  842.         MainButton(7).Value = True
  843.     Else
  844.         Beep
  845.     End If
  846. End Sub
  847. Sub altCascade_Click ()
  848. ' Cascade the icons of the MDI application
  849.     MDIMA.Arrange CASCADE
  850. End Sub
  851. Sub altClear_Click ()
  852. ' Clears the content of the form by automatically
  853. ' pressing the Clear button in the main tool bar:
  854.     If MainButton(4).Enabled Then
  855.         MainButton(4).Value = True
  856.     Else
  857.         Beep
  858.     End If
  859. End Sub
  860. Sub altClose_Click ()
  861. ' Closes the form by unloading it, thus securing
  862. ' that any unload procedure will be carried out:
  863.     Unload Me
  864. End Sub
  865. Sub altContents_Click ()
  866. Dim x%, lHelpPath As String
  867. ' Activate the help system
  868.     lHelpPath = App.Path + "\pubs1.hlp"
  869.     x% = WinHelp(MDIMA.hWnd, lHelpPath, HELP_INDEX, 0)
  870. End Sub
  871. Sub altCopy_Click ()
  872. ' Sets the mode to SQLNEW, thus allowing the record
  873. ' in the form to be modified and then inserted, then
  874. ' sets focus to the first text field in the form. This
  875. ' function can save some typing:
  876.     Mode = SQLNEW
  877.     txtAuthors(1).SetFocus
  878. End Sub
  879. Sub altDelete_Click ()
  880. ' Starts a delete procedure by pressing the delete
  881. ' button in the main tool bar. If it is enabled, the
  882. ' process controlled by the button will be started,
  883. ' otherwise there will be a beep, telling that there
  884. ' is nothing to delete at present:
  885.     If MainButton(3).Enabled Then
  886.         MainButton(3).Value = True
  887.     Else
  888.         Beep
  889.     End If
  890. End Sub
  891. Sub altExit_Click ()
  892. ' Exit the entire application by unloading the MDI
  893. ' form. The result will be that any opened MDI child
  894. ' window will be unloaded, their respective unload
  895. ' procedures automatically carried out:
  896.     Unload MDIMA
  897. End Sub
  898. Sub altNew_Click ()
  899. ' Start the NEW procedure to enter and insert information
  900. ' about a new author. If the corresponding button in the
  901. ' main tool bar is enabled, it is pushed, otherwise a new
  902. ' author could not be entered at this state of the form,
  903. ' and a beep is heard:
  904.     If MainButton(1).Enabled Then
  905.         MainButton(1).Value = True
  906.     Else
  907.         Beep
  908.     End If
  909. End Sub
  910. Sub altNormalSize_Click ()
  911. ' Reinstate the normal size of the form, if changed
  912.     If Me.WindowState <> 0 Then Me.WindowState = 0  ' normal size
  913.     Me.Width = DEFWIDTH%
  914.     If FormMaxOpen Then
  915.         Me.Height = DEFMAXHEIGHT%
  916.     Else
  917.         Me.Height = DEFMINHEIGHT%
  918.     End If
  919.     CenterForm
  920. End Sub
  921. Sub altQuery_Click ()
  922. ' Send a query to SQL Server by pushing the corresponding
  923. ' push button in the tool bar, if it is enabled. If not,
  924. ' there is no query to send and a beep is heard:
  925.     If MainButton(6).Enabled Then
  926.         MainButton(6).Value = True
  927.     Else
  928.         Beep
  929.     End If
  930. End Sub
  931. Sub altRefresh_Click ()
  932. ' Send the same query as was last sent to SQL Server,
  933. ' thereby refreshing the result set to include any
  934. ' changes made by other users since the data was last
  935. ' selected:
  936. ' Pushes the corresponding button in the main tool bar
  937. ' if it is enabled. If not, a beep is heard, signalling
  938. ' that refresh is an inappropriate operation at this time:
  939.     If MainButton(5).Enabled Then
  940.         MainButton(5).Value = True
  941.     Else
  942.         Beep
  943.     End If
  944. End Sub
  945. Sub altRelease_Click ()
  946. ' Releases the record in the form from its connection
  947. ' with the database, allowing the user to make changes
  948. ' and then use the result as an example for a query.
  949. ' Sets the MODE variable to SQLREST, indicating that the
  950. ' form is "resting" (will not allow saving the info)
  951.     Mode = SQLREST
  952. End Sub
  953. Sub altSave_Click ()
  954. ' Saves the content of the form to SQL Server by issuing
  955. ' an UPDATE or INSERT statement. Uses the corresponding
  956. ' push button in the main tool bar if it is enabled.
  957. ' Otherwise a beep is heard, indicating that there is
  958. ' nothing to save right now:
  959.     If MainButton(2).Enabled Then
  960.         MainButton(2).Value = True
  961.     Else
  962.         Beep
  963.     End If
  964. End Sub
  965. Sub altShowSQL_Click ()
  966. ' Controls wether SQL statements are shown in a message
  967. ' box or not. When this menu option is checked, all
  968. ' SQL statements are shown before sent to the server:
  969.     If altShowSQL.Checked Then
  970.         altShowSQL.Checked = False
  971.         ShowSQL = False
  972.     Else
  973.         altShowSQL.Checked = True
  974.         ShowSQL = True
  975.     End If
  976. End Sub
  977. Sub AltTile_Click ()
  978. ' Tile the icons of the MDI application
  979.     MDIMA.Arrange TILE_HORIZONTAL
  980. End Sub
  981. Sub CenterForm ()
  982.     Me.Top = screen.Height / 2 - Me.Height / 2 - 710
  983. End Sub
  984. Sub chkContract_Click (Value As Integer)
  985. ' If the form is not resting (MODE <> SQLREST), the
  986. ' SAVE and CANCEL buttons are enabled, indicating that
  987. ' some information that should be saved has been entered:
  988.     If Mode <> SQLREST Then
  989.         MainButton(2).Enabled = True        ' save button
  990.         MainButton(7).Enabled = True        ' cancel button
  991.     End If
  992. End Sub
  993. Sub ClearFields ()
  994. ' Clear the contents of any field in the form
  995. Dim x As Integer, lMODE As Integer
  996.     lMODE = Mode        ' Save actual Mode value
  997.     Mode = SQLREST      ' Set Mode to resting
  998.     For x = 1 To 8
  999.         txtAuthors(x).Text = ""
  1000.     Next
  1001.     chkContract.Value = False
  1002.     Mode = lMODE        ' Reset initial mode
  1003. End Sub
  1004. Sub ClearForm ()
  1005. Dim lMODE As Integer
  1006.     lMODE = Mode        ' Save actual mode
  1007.     Mode = SQLREST      ' Set mode to resting
  1008.     lstPrim.Clear       ' Clear primary list box
  1009.     ClearFields         ' Clear all fields
  1010.     If FormMaxOpen Then ClearGrid grdTitles ' clear the grid
  1011.     panItemsRead.Caption = ""
  1012.     panItemsRemoved.Caption = ""
  1013.     Mode = lMODE        ' Reset initial mode
  1014.     SetMainButtons Mode ' Enable/Disable buttons in toolbar
  1015.     txtAuthors(1).SetFocus
  1016. End Sub
  1017. Sub ClearGrid (pGrid As Control)
  1018. ' Clear the grid
  1019. Dim x As Integer, y As Integer
  1020.     For x = 1 To pGrid.Rows - 1
  1021.         pGrid.Row = x
  1022.         For y = 0 To pGrid.Cols - 1
  1023.             pGrid.Col = y
  1024.             pGrid.Text = ""
  1025.         Next
  1026.     Next
  1027. End Sub
  1028. Sub cmdDown_Click (Value As Integer)
  1029. ' Shows the sub grid with titles for an author
  1030.     If cmdDown.Value = False Then
  1031.         SubGridClose
  1032.         Exit Sub
  1033.     End If
  1034.     If Me.WindowState <> 2 Then
  1035.         Me.Height = DEFMAXHEIGHT%
  1036.         CenterForm
  1037.     End If
  1038.     FormMaxOpen = True
  1039.     frmTitles.Visible = True
  1040.     If Len(RTrim$(txtAuthors(1).Text)) > 0 Then
  1041.         cmdSubGridDetail.Value = True
  1042.     Else
  1043.         HighlightGridRow grdTitles, 1
  1044.     End If
  1045. End Sub
  1046. Sub cmdMoreRows_Click ()
  1047. ' This button is enabled whenever the result set
  1048. ' contains rows that has not yet been read and
  1049. ' transferred to the lstPrim listbox. When the
  1050. ' user presses this button another chunk of
  1051. ' CHUNKSIZE% rows are read. When all the rows of
  1052. ' the result set has been read (NO_MORE_ROWS) this
  1053. ' button is disabled.
  1054.     SQLGetRows
  1055. End Sub
  1056. Sub cmdSubGridDetail_Click ()
  1057. ' Sending a SQL statement and filling the sub grid
  1058. ' with titles for a specific author
  1059. Dim lCmd$, lId$, res%
  1060.     lId$ = txtAuthors(1).Text
  1061.     lCmd$ = "select t.title_id, title, type, price, "
  1062.     lCmd$ = lCmd$ + "advance, royalty, ytd_sales, "
  1063.     lCmd$ = lCmd$ + "notes, pubdate "
  1064.     lCmd$ = lCmd$ + "from titles t, titleauthor ta "
  1065.     lCmd$ = lCmd$ + "where t.title_id = ta.title_id "
  1066.     lCmd$ = lCmd$ + "and ta.au_id = " + Chr$(34) + lId$ + Chr$(34)
  1067.     ClearGrid grdTitles
  1068.     res% = SQLComm(UpdChannel%, lCmd$)
  1069.     If res% = SUCCEED Then SQLFillGrid grdTitles, UpdChannel%
  1070.     HighlightGridRow grdTitles, 1
  1071. End Sub
  1072. Function EvaluateForm ()
  1073. ' Evaluate each field in the form and create a where clause
  1074. ' for the Select statement
  1075. Dim lRetStr$, x As Integer
  1076.     ' Initialize return string.
  1077.     ' (Not neccessary but neater.)
  1078.     lRetStr$ = ""
  1079.     For x = 1 To 8      ' Loop through each text box in form
  1080.         If Len(RTrim$(txtAuthors(x).Text)) > 0 Then
  1081.             If Len(Trim$(lRetStr$)) Then lRetStr$ = lRetStr$ + " and "
  1082.             Select Case x
  1083.                 ' Build condition for each field:
  1084.                 Case 1
  1085.                     lRetStr$ = lRetStr$ + "au_id like " + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34)
  1086.                 Case 2
  1087.                     lRetStr$ = lRetStr$ + "au_fname like " + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34)
  1088.                 Case 3
  1089.                     lRetStr$ = lRetStr$ + "au_lname like " + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34)
  1090.                 Case 4
  1091.                     lRetStr$ = lRetStr$ + "address like " + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34)
  1092.                 Case 5
  1093.                     lRetStr$ = lRetStr$ + "zip like " + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34)
  1094.                 Case 6
  1095.                     lRetStr$ = lRetStr$ + "city like " + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34)
  1096.                 Case 7
  1097.                     lRetStr$ = lRetStr$ + "state like " + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34)
  1098.                 Case 8
  1099.                     lRetStr$ = lRetStr$ + "phone like " + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34)
  1100.             End Select
  1101.         End If
  1102.     Next
  1103.     ' Check check box content, build upon the where clause:
  1104.     If chkContract.Value = True Then        ' checked
  1105.         If Len(Trim$(lRetStr$)) Then lRetStr$ = lRetStr$ + " and "
  1106.         lRetStr$ = lRetStr$ + "contract = 1"
  1107.     End If
  1108.     LastWhereClause = lRetStr$      ' Save as last used clause
  1109.     EvaluateForm = lRetStr$         ' Return where clause
  1110. End Function
  1111. Sub Form_Activate ()
  1112.     If ShowSQL Then
  1113.         altShowSQL.Checked = True
  1114.     Else
  1115.         altShowSQL.Checked = False
  1116.     End If
  1117. End Sub
  1118. Sub Form_Load ()
  1119. ' Set up the form at load time
  1120. Dim res%, lMsg$
  1121.     ' Set The Width and Height properties of the form
  1122.     ' to their predefined values. Setting the Top and
  1123.     ' Left properties to center the form within the
  1124.     ' MDI form:
  1125.     Me.Width = DEFWIDTH%
  1126.     Me.Height = DEFMINHEIGHT%
  1127.     CenterForm
  1128.     Me.Left = screen.Width / 2 - Me.Width / 2
  1129.     ' Opening two connections to SQL Server, one for selecting
  1130.     ' sets of authors, another for updating purposes.
  1131.     ' Putting the pubs database (Database$) in use:
  1132.     SelChannel = Logon%(Server$, LoginId$, Password$, WorkSta$, AppName$)
  1133.     UpdChannel = Logon%(Server$, LoginId$, Password$, WorkSta$, AppName$)
  1134.     res% = SqlUse(SelChannel, Database$)
  1135.     res% = SqlUse(UpdChannel, Database$)
  1136.     ' Check the status of the TIMESTAMP column in the Authors table
  1137.     res% = CheckifTimestamp(SelChannel)
  1138.     If res% = False Then
  1139.         res% = AskifAlter()
  1140.         If res% Then
  1141.             res% = AlterAuthors(SelChannel)
  1142.             Beep
  1143.             If res% Then
  1144.                 lMsg$ = "The Authors table has been successfully altered with a TIMESTAMP column."
  1145.                 MsgBox lMsg$, 64
  1146.             Else
  1147.                 lMsg$ = "There was some problem altering and updating the Authors table." + NEWLINE$ + NEWLINE$
  1148.                 lMsg$ = lMsg$ + "The sample application will terminate."
  1149.                 MsgBox lMsg$, 48
  1150.                 Unload MDIMA
  1151.             End If
  1152.         Else
  1153.             Beep
  1154.             MsgBox "Sorry, the sample application will terminate.", 48
  1155.             Unload MDIMA            ' this will terminate the application
  1156.         End If
  1157.     End If
  1158.     ' Specify the sub grid for titles
  1159.     SpecifyGrid
  1160. End Sub
  1161. Sub Form_Unload (Cancel As Integer)
  1162.     SqlClose SelChannel
  1163.     SqlClose UpdChannel
  1164. End Sub
  1165. Sub grdTitles_Click ()
  1166.     HighlightGridRow grdTitles, (grdTitles.Row)
  1167. End Sub
  1168. Sub HandleEmptyQual ()
  1169. Dim lMsg$
  1170.     Beep
  1171.     lMsg$ = EmptyQualString()
  1172.     MsgBox lMsg$, 16, "Empty qual string"
  1173.     RefreshFormFields
  1174. End Sub
  1175. Sub HighlightGridRow (pGrid As Control, pRowNmbr As Integer)
  1176. ' Highlights the selected row in the grid
  1177.     If pRowNmbr = 0 Then pRowNmbr = 1       ' to avoide VB error
  1178.     pGrid.Row = pRowNmbr
  1179.     pGrid.SelStartRow = pRowNmbr
  1180.     pGrid.SelEndRow = pRowNmbr
  1181.     pGrid.Col = pGrid.Cols - 1
  1182.     pGrid.SelStartCol = 0
  1183.     pGrid.SelEndCol = pGrid.Cols - 1
  1184. End Sub
  1185. Sub lstPrim_Click ()
  1186. ' If there are any items in the primary list box when
  1187. ' a click event occurs, then SQLGetDetailRow is called
  1188. ' to get all information on the selected author and put
  1189. ' it in the form fields. MODE is set to SQLREST in order
  1190. ' to prevent some change actions on the different fields.
  1191. ' After the author is shown, MODE is set to SQLSHOW,
  1192. ' indicating that the form is active (an author in it)
  1193.     If lstPrim.ListIndex <> -1 Then
  1194.         Mode = SQLREST
  1195.         SQLGetDetailRow
  1196.         Mode = SQLSHOW
  1197.     End If
  1198. End Sub
  1199. Sub MainButton_Click (index As Integer)
  1200. Dim x As Integer
  1201. ' MainButton is a control array of push buttons.
  1202. ' They may be clicked by the user directly or by
  1203. ' menu choices where the users select a menu item
  1204. ' and the menu item pushes a button by setting its
  1205. ' Value property True.
  1206.     Select Case index
  1207.         Case 1              ' new
  1208.             ' Click button 4 to clear the fields:
  1209.             MainButton(4).Value = True
  1210.             ' Enable the cancel button:
  1211.             MainButton(7).Enabled = True
  1212.             ' Set MODE to SQLNEW to allow saving:
  1213.             Mode = SQLNEW
  1214.         Case 2              ' save
  1215.             ' Call the SAVE routine, who knows how
  1216.             ' to do inserts and updates:
  1217.             SQLSave
  1218.         Case 3              ' delete
  1219.             ' Call the SQLDelete routine:
  1220.             SQLDelete
  1221.         Case 4              ' clear form
  1222.             ClearForm
  1223.         Case 5              ' refresh
  1224.             ' Send the same Select statement as last was sent:
  1225.             SQLQuery "REFRESH"
  1226.         Case 6              ' query
  1227.             ' Send a Select statement based on examples given
  1228.             ' by filling in parts of the form:
  1229.             SQLQuery ""
  1230.         Case 7              ' cancel
  1231.             ' Reset to same as before any changes were made:
  1232.             If Mode = SQLSHOW Then
  1233.                 Mode = SQLREST
  1234.                 x = lstPrim.ListIndex
  1235.                 lstPrim.ListIndex = -1
  1236.                 lstPrim.ListIndex = x
  1237.                 Mode = SQLSHOW
  1238.             Else
  1239.                 ClearForm
  1240.                 Mode = SQLREST
  1241.             End If
  1242.     End Select
  1243. End Sub
  1244. Sub RefreshFormFields ()
  1245. Dim x As Integer
  1246.     x = lstPrim.ListIndex
  1247.     lstPrim.ListIndex = -1
  1248.     lstPrim.ListIndex = x
  1249. End Sub
  1250. Function RowToListbox ()
  1251. ' Building a string to be added to the listbox:
  1252. Dim lBoxString As String
  1253.     ' Last and First Name:
  1254.     lBoxString = RTrim$(SQLData(SelChannel, 1)) + ", " + SQLData(SelChannel, 2)
  1255.     ' Id:
  1256.     lBoxString = Left$(lBoxString + Space$(LISTWIDTH%), LISTWIDTH%) + SQLData(SelChannel, 3)
  1257.     RowToListbox = lBoxString
  1258. End Function
  1259. Sub SetMainButtons (pMode As Integer)
  1260. ' Enable/Disable buttons in tool bar based on
  1261. ' actual Mode:
  1262.     MainButton(1).Enabled = True
  1263.     MainButton(2).Enabled = False
  1264.     MainButton(4).Enabled = True
  1265.     MainButton(7).Enabled = False
  1266.     If pMode = SQLSHOW Then
  1267.         MainButton(3).Enabled = True
  1268.     Else
  1269.         MainButton(3).Enabled = False
  1270.     End If
  1271. End Sub
  1272. Sub SetNmbrofRowsPanels (pNmbrRows, pRemoved)
  1273. ' Sets the right information for how many
  1274. ' rows that have been read from the result
  1275. ' set, and how many rows that have been
  1276. ' removed from the listbox:
  1277.     If Len(panItemsRead.Caption) > 0 Then
  1278.         pNmbrRows = pNmbrRows + Val(panItemsRead.Caption)
  1279.     End If
  1280.     If Len(panItemsRemoved.Caption) > 0 Then
  1281.         pRemoved = Val(panItemsRemoved.Caption) + pRemoved
  1282.     End If
  1283.     panItemsRead.Caption = Str$(pNmbrRows) + " rows read"
  1284.     If pRemoved > 0 Then
  1285.         panItemsRemoved.Caption = Str$(pRemoved) + " rows removed"
  1286.     Else
  1287.         panItemsRemoved.Caption = ""
  1288.     End If
  1289. End Sub
  1290. Sub SpecifyGrid ()
  1291. ' Specify the sub grid for titles
  1292.     grdTitles.Rows = 10
  1293.     grdTitles.Cols = 9
  1294.     grdTitles.Row = 0
  1295.     grdTitles.Col = 0
  1296.     grdTitles.Text = "Title id"
  1297.     grdTitles.ColWidth(0) = 750
  1298.     grdTitles.Col = 1
  1299.     grdTitles.Text = "Title"
  1300.     grdTitles.ColWidth(1) = 3500
  1301.     grdTitles.Col = 2
  1302.     grdTitles.Text = "Type"
  1303.     grdTitles.ColWidth(2) = 855
  1304.     grdTitles.Col = 3
  1305.     grdTitles.Text = "Price"
  1306.     grdTitles.ColWidth(3) = 645
  1307.     grdTitles.Col = 4
  1308.     grdTitles.Text = "Advance"
  1309.     grdTitles.ColWidth(4) = 960
  1310.     grdTitles.Col = 5
  1311.     grdTitles.Text = "Royalty"
  1312.     grdTitles.ColWidth(5) = 645
  1313.     grdTitles.Col = 6
  1314.     grdTitles.Text = "YTD sales"
  1315.     grdTitles.ColWidth(6) = 840
  1316.     grdTitles.Col = 7
  1317.     grdTitles.Text = "Notes"
  1318.     grdTitles.ColWidth(7) = 4050
  1319.     grdTitles.Col = 8
  1320.     grdTitles.Text = "Pub. date"
  1321.     grdTitles.ColWidth(8) = 1050
  1322. End Sub
  1323. Sub SQLDelete ()
  1324. ' Create an appropriate delete statement, based on the actual
  1325. ' record shown in the form. Ask the user to confirm the delete.
  1326. ' If all is well: Send the delete statement:
  1327. Dim lCmd$, x As Integer, res%
  1328.     If Len(RTrim$(txtAuthors(1).Text)) = 0 Or Mode <> SQLSHOW Then
  1329.         Beep
  1330.         Exit Sub            ' Nothing to delete
  1331.     End If
  1332.     If Len(RTrim$(txtAuthors(1).Text)) > 0 Then
  1333.         lCmd$ = "Delete authors " + QualString
  1334.         ' Check if the variable QualString is blank - if so we can
  1335.         ' not allow any deletions
  1336.         If Len(RTrim$(QualString)) = 0 Then
  1337.             HandleEmptyQual
  1338.             screen.MousePointer = 0
  1339.             Exit Sub
  1340.         End If
  1341.         
  1342.         If MsgBox("Do you really want to delete this row?", 36, "Delete") = 6 Then
  1343.             ' Use the SQLComm function to perform the delete:
  1344.             screen.MousePointer = 11
  1345.             res% = SQLComm%(UpdChannel, lCmd$)
  1346.             If res% = SUCCEED% Then
  1347.                 ' Remove record from form and set up form for continuation:
  1348.                 Mode = SQLREST
  1349.                 x = lstPrim.ListIndex
  1350.                 ClearFields
  1351.                 If x <> -1 Then lstPrim.RemoveItem x
  1352.                 ClearGrid grdTitles
  1353.             End If
  1354.             screen.MousePointer = 0
  1355.         End If
  1356.     End If
  1357. End Sub
  1358. Sub SQLFillGrid (pGrid As Control, pChannel%)
  1359. ' Filling then grid with data
  1360. Dim x As Integer
  1361.     pGrid.Row = 0: pGrid.Rows = 10
  1362.     Do
  1363.         res% = SQLNextRow(pChannel%)
  1364.         Select Case res%
  1365.         Case REGROW
  1366.             If pGrid.Row >= pGrid.Rows - 1 Then pGrid.Rows = pGrid.Rows + 1
  1367.             pGrid.Row = pGrid.Row + 1
  1368.             For x = 0 To pGrid.Cols - 1
  1369.                 pGrid.Col = x
  1370.                 pGrid.Text = SQLData(pChannel%, x + 1)
  1371.             Next
  1372.         Case NOMOREROWS
  1373.             pGrid.Col = 0
  1374.             pGrid.Row = 1
  1375.             Exit Do
  1376.         Case Else
  1377.             Exit Do        ' error message by ordinary VBSQL-error routine
  1378.         End Select
  1379.     Loop Until 1 = 0
  1380. ' ------------------------------------------------
  1381. End Sub
  1382. Sub SQLGetDetailRow ()
  1383. ' The user has selected an item in the primary list box.
  1384. ' This routine creates and sends a SQL statement to
  1385. ' retrieve all information on the selected author:
  1386. Dim lAu_Id$, lCmd$, res%, x As Integer
  1387.     screen.MousePointer = 11
  1388.     ' The AU_ID field is positioned beyond LISTWIDTH% in the list box item:
  1389.     lAu_Id$ = Mid$(lstPrim.List(lstPrim.ListIndex), LISTWIDTH% + 1)
  1390.     lCmd$ = "select au_id, au_fname, au_lname, address, zip, city, "
  1391.     lCmd$ = lCmd$ + "state, phone, contract "
  1392.     lCmd$ = lCmd$ + "from authors "
  1393.     lCmd$ = lCmd$ + "where au_id = " + Chr$(34) + lAu_Id$ + Chr$(34)
  1394.     lCmd$ = lCmd$ + " FOR BROWSE"
  1395.     ' Send the select statement and check the result:
  1396.     res% = SQLComm(UpdChannel, lCmd$)
  1397.     If res% = SUCCEED% Then
  1398.         res% = SQLNextRow(UpdChannel)
  1399.         QualString = sqlqual(UpdChannel, 1, "")
  1400.         If res% = REGROW Then
  1401.             ' Show each separate field:
  1402.             For x = 1 To 8
  1403.                 txtAuthors(x).Text = SQLData(UpdChannel, x)
  1404.             Next
  1405.             chkContract.Value = SQLData(UpdChannel, 9)
  1406.         End If
  1407.     End If
  1408.     ' Check to see if the sub grid is showned - if so we will
  1409.     ' refresh it with data from the selected author
  1410.     If FormMaxOpen Then cmdSubGridDetail.Value = True
  1411.     screen.MousePointer = 0
  1412. End Sub
  1413. Sub SQLGetRows ()
  1414. ' This routine loops through the result set and
  1415. ' add rows to the listbox:
  1416. Dim lNmbrRows As Integer, lItems%, res%
  1417. Dim lNoMoreRowsToRead  As Integer, lRemoved As Integer
  1418.     lNoMoreRowsToRead = False
  1419.     For lNmbrRows = 1 To CHUNKSIZE%
  1420.         res% = SQLNextRow(SelChannel)
  1421.         If res% = REGROW Then
  1422.             lstPrim.AddItem RowToListbox()
  1423.         ElseIf res% = NOMOREROWS Then
  1424.             lNoMoreRowsToRead = True
  1425.             Exit For
  1426.         Else
  1427.             Exit For            ' error message by ordinary VBSQL-error routine
  1428.         End If
  1429.         If lstPrim.ListCount > LSTPRIMMAX% Then
  1430.             lstPrim.RemoveItem 0
  1431.             lRemoved = lRemoved + 1
  1432.         End If
  1433.     Next
  1434.     lNmbrRows = lNmbrRows - 1
  1435.     If lNoMoreRowsToRead Then          'no more rows to read from the result set
  1436.         cmdMoreRows.Enabled = False
  1437.     Else
  1438.         cmdMoreRows.Enabled = True
  1439.     End If
  1440.     SetNmbrofRowsPanels lNmbrRows, lRemoved
  1441. End Sub
  1442. Sub SQLInsert ()
  1443. ' Create an Insert statement and send it to SQL Server:
  1444. Dim lCmd$, x As Integer, res%, lKey$
  1445.     screen.MousePointer = 11
  1446.     lCmd$ = "Insert authors ("
  1447.     lCmd$ = lCmd$ + "au_id, au_fname, au_lname, address, "
  1448.     lCmd$ = lCmd$ + "zip, city, state, phone, contract) "
  1449.     lCmd$ = lCmd$ + "values ("
  1450.     For x = 1 To 8      ' Evaluate the content of each field
  1451.         lCmd$ = lCmd$ + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34) + ", "
  1452.     Next
  1453.     lCmd$ = lCmd$ + Abs(chkContract.Value) + ")"
  1454.     ' Send to SQL Server and check result; Set up form after success:
  1455.     res% = SQLComm%(SelChannel, lCmd$)
  1456.     If res% = SUCCEED% Then
  1457.         Mode = SQLREST
  1458.         lKey$ = txtAuthors(1).Text
  1459.         MainButton(4).Value = True      ' Clear form
  1460.         txtAuthors(1).Text = lKey$      ' Set up query for inserted Author
  1461.         MainButton(6).Value = True      ' Send query
  1462.         Mode = SQLSHOW
  1463.     Else
  1464.         Mode = SQLREST
  1465.     End If
  1466.     lstPrim.SetFocus
  1467.     screen.MousePointer = 0
  1468. End Sub
  1469. Sub SQLQuery (pMode As String)
  1470. ' Evaluate the form content for a QBE Select statement
  1471. ' Send it to SQL Server. Read the result set and use it
  1472. ' to populate the primary list box:
  1473. Dim lCmd$, lWhereClause$, res%
  1474.     screen.MousePointer = 11
  1475.     Mode = SQLREST
  1476.     panItemsRead.Caption = ""
  1477.     panItemsRemoved.Caption = ""
  1478.     If pMode = "REFRESH" Then
  1479.         lWhereClause$ = LastWhereClause$
  1480.     Else
  1481.         lWhereClause$ = EvaluateForm()
  1482.     End If
  1483.     lstPrim.Clear
  1484.     lCmd$ = "select au_lname, au_fname, au_id "
  1485.     lCmd$ = lCmd$ + "from authors "
  1486.     If Len(RTrim$(lWhereClause$)) Then
  1487.         lCmd$ = lCmd$ + "where " + lWhereClause$ + " "
  1488.     End If
  1489.     lCmd$ = lCmd$ + "order by au_lname, au_fname"
  1490.     res% = SQLComm(SelChannel, lCmd$)
  1491.     If res% = SUCCEED% Then
  1492.         SQLGetRows
  1493.     End If
  1494.     If lstPrim.ListCount > 0 Then
  1495.         lstPrim.ListIndex = 0           ' Autoclick on first in list box
  1496.         Mode = SQLSHOW
  1497.         SetMainButtons Mode
  1498.     Else
  1499.         Mode = SQLREST
  1500.     End If
  1501.     screen.MousePointer = 0
  1502. End Sub
  1503. Sub SQLSave ()
  1504. ' Choose wether to create an insert or update statement based
  1505. ' on the actual Mode:
  1506.     If Mode = SQLNEW Then
  1507.         SQLInsert
  1508.     Else
  1509.         SQLUpdate
  1510.     End If
  1511.     ' NOTE: Mode will be changed by SQLInsert/SQLUpdate
  1512.     SetMainButtons Mode
  1513. End Sub
  1514. Sub SQLUpdate ()
  1515. ' Create an Update statement and send it to SQL Server:
  1516. Dim lCmd$, lRow$, x As Integer, res%
  1517.     screen.MousePointer = 11
  1518.     If Len(RTrim$(txtAuthors(1).Text)) > 0 Then
  1519.         lCmd$ = "Update authors set "
  1520.         For x = 2 To 8      ' Evaluate the content of each non key field
  1521.             Select Case x
  1522.                 Case 2
  1523.                     lCmd$ = lCmd$ + "au_fname = " + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34) + ", "
  1524.                 Case 3
  1525.                     lCmd$ = lCmd$ + "au_lname = " + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34) + ", "
  1526.                 Case 4
  1527.                     lCmd$ = lCmd$ + "address = " + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34) + ", "
  1528.                 Case 5
  1529.                     lCmd$ = lCmd$ + "zip = " + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34) + ", "
  1530.                 Case 6
  1531.                     lCmd$ = lCmd$ + "city = " + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34) + ", "
  1532.                 Case 7
  1533.                     lCmd$ = lCmd$ + "state = " + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34) + ", "
  1534.                 Case 8
  1535.                     lCmd$ = lCmd$ + "phone = " + Chr$(34) + RTrim$(txtAuthors(x).Text) + Chr$(34) + ", "
  1536.             End Select
  1537.         Next
  1538.         lCmd$ = lCmd$ + "contract = " + Abs(chkContract.Value)
  1539.         lCmd$ = lCmd$ + " " + QualString
  1540.         ' Control to see if the variable QualString is blank - if so we can not allow any update
  1541.         If Len(RTrim$(QualString)) = 0 Then
  1542.             HandleEmptyQual
  1543.             screen.MousePointer = 0
  1544.             Exit Sub
  1545.         End If
  1546.         ' Send to SQL Server and check result; Set up form after success:
  1547.         res% = SQLComm%(UpdChannel, lCmd$)
  1548.         If res% = SUCCEED% Then
  1549.             Mode = SQLREST
  1550.             lRow$ = Left$(RTrim$(txtAuthors(3).Text) + ", " + txtAuthors(2).Text + Space$(LISTWIDTH%), LISTWIDTH%) + txtAuthors(1).Text
  1551.             ' Modify list box item to reflect possible changes from update:
  1552.             If lstPrim.ListIndex <> -1 Then     ' to prevent a VB error
  1553.                 x = lstPrim.ListIndex
  1554.                 lstPrim.RemoveItem x
  1555.                 lstPrim.AddItem lRow$, x
  1556.                 lstPrim.ListIndex = x
  1557.                 Mode = SQLSHOW
  1558.             End If
  1559.         Else
  1560.             RefreshFormFields
  1561.         End If
  1562.     Else
  1563.         Beep
  1564.         MsgBox "The update operation was not successful.", 16
  1565.     End If
  1566.     screen.MousePointer = 0
  1567. End Sub
  1568. Sub SubGridClose ()
  1569. ' Clears the grid and makes it invisible
  1570.     If Me.WindowState <> 2 Then
  1571.         Me.Height = DEFMINHEIGHT%
  1572.         CenterForm
  1573.     End If
  1574.     FormMaxOpen = False
  1575.     ClearGrid grdTitles
  1576.     frmTitles.Visible = False
  1577. End Sub
  1578. Sub txtAuthors_Change (index As Integer)
  1579. ' If changes are made to any text field included in the
  1580. ' control array of text boxes, and if MODE is anything
  1581. ' else than SQLREST, then enable the save button and
  1582. ' the cancel button. This makes it possible to save or
  1583. ' cancel any modifications made:
  1584.     If Mode <> SQLREST Then
  1585.         MainButton(2).Enabled = True        ' save button
  1586.         MainButton(7).Enabled = True        ' cancel button
  1587.     End If
  1588. End Sub
  1589. Sub txtAuthors_GotFocus (index As Integer)
  1590.     ' Modification of key field prevented
  1591.     If Mode = SQLSHOW And index = 1 Then txtAuthors(index + 1).SetFocus
  1592.     ' Highlight existing entry
  1593.     txtAuthors(index).SelStart = 0
  1594.     txtAuthors(index).SelLength = Len(RTrim$(txtAuthors(index).Text))
  1595. End Sub
  1596.