home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Programmer'…arterly (Limited Edition) / Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso / code / ch06code / commands.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-08-15  |  8.7 KB  |  250 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "SQL Commands from Chapter 6 Listings"
  4.    ClientHeight    =   4440
  5.    ClientLeft      =   1110
  6.    ClientTop       =   2010
  7.    ClientWidth     =   7530
  8.    Height          =   4905
  9.    Left            =   1020
  10.    LinkTopic       =   "Form1"
  11.    MDIChild        =   -1  'True
  12.    ScaleHeight     =   4440
  13.    ScaleWidth      =   7530
  14.    Top             =   1635
  15.    Width           =   7710
  16.    Begin VB.CommandButton Command14 
  17.       Caption         =   "Listing 6.17"
  18.       Height          =   375
  19.       Left            =   4560
  20.       TabIndex        =   13
  21.       Top             =   2040
  22.       Width           =   2295
  23.    End
  24.    Begin VB.CommandButton Command13 
  25.       Caption         =   "Listing 6.20"
  26.       Height          =   375
  27.       Left            =   4560
  28.       TabIndex        =   12
  29.       Top             =   3840
  30.       Width           =   2295
  31.    End
  32.    Begin VB.CommandButton Command12 
  33.       Caption         =   "Listing 6.19"
  34.       Height          =   375
  35.       Left            =   4560
  36.       TabIndex        =   11
  37.       Top             =   3240
  38.       Width           =   2295
  39.    End
  40.    Begin VB.CommandButton Command11 
  41.       Caption         =   "Listing 6.18"
  42.       Height          =   375
  43.       Left            =   4560
  44.       TabIndex        =   10
  45.       Top             =   2640
  46.       Width           =   2295
  47.    End
  48.    Begin VB.CommandButton Command10 
  49.       Caption         =   "Listing 6.15"
  50.       Height          =   375
  51.       Left            =   4560
  52.       TabIndex        =   9
  53.       Top             =   1440
  54.       Width           =   2295
  55.    End
  56.    Begin VB.CommandButton Command9 
  57.       Caption         =   "Listing 6.14"
  58.       Height          =   375
  59.       Left            =   4560
  60.       TabIndex        =   8
  61.       Top             =   840
  62.       Width           =   2295
  63.    End
  64.    Begin VB.CommandButton Command8 
  65.       Caption         =   "Listing 6.13"
  66.       Height          =   375
  67.       Left            =   4560
  68.       TabIndex        =   7
  69.       Top             =   240
  70.       Width           =   2295
  71.    End
  72.    Begin VB.CommandButton Command7 
  73.       Caption         =   "Listing 6.12 (Numeric)"
  74.       Height          =   375
  75.       Left            =   720
  76.       TabIndex        =   6
  77.       Top             =   3840
  78.       Width           =   2295
  79.    End
  80.    Begin VB.CommandButton Command6 
  81.       Caption         =   "Listing 6.11"
  82.       Height          =   375
  83.       Left            =   720
  84.       TabIndex        =   5
  85.       Top             =   3240
  86.       Width           =   2295
  87.    End
  88.    Begin VB.CommandButton Command5 
  89.       Caption         =   "Listing 6.10 (Inner Join)"
  90.       Height          =   375
  91.       Left            =   720
  92.       TabIndex        =   4
  93.       Top             =   2640
  94.       Width           =   2295
  95.    End
  96.    Begin VB.CommandButton Command4 
  97.       Caption         =   "Listing 6.4 (Partial)"
  98.       Height          =   375
  99.       Left            =   720
  100.       TabIndex        =   3
  101.       Top             =   2040
  102.       Width           =   2295
  103.    End
  104.    Begin VB.CommandButton Command3 
  105.       Caption         =   "Listing 6.3"
  106.       Height          =   375
  107.       Left            =   720
  108.       TabIndex        =   2
  109.       Top             =   1440
  110.       Width           =   2295
  111.    End
  112.    Begin VB.CommandButton Command2 
  113.       Caption         =   "Listing 6.2"
  114.       Height          =   375
  115.       Left            =   720
  116.       TabIndex        =   1
  117.       Top             =   840
  118.       Width           =   2295
  119.    End
  120.    Begin VB.CommandButton Command1 
  121.       Caption         =   "Listing 6.1"
  122.       Height          =   375
  123.       Left            =   720
  124.       TabIndex        =   0
  125.       Top             =   240
  126.       Width           =   2295
  127.    End
  128. Attribute VB_Name = "Form1"
  129. Attribute VB_Creatable = False
  130. Attribute VB_Exposed = False
  131. Private Sub Command1_Click()
  132.     MydbName = App.Path & "\TRITON.MDB"
  133.     MyrcSource = "SELECT * FROM Sales"
  134.     Dim newgrid As New Form2
  135.     newgrid.Show
  136. End Sub
  137. Private Sub Command10_Click()
  138.     MydbName = App.Path & "\TRITON.MDB"
  139.     MyrcSource = "SELECT * FROM [Retail Items] WHERE Retail BETWEEN 1 AND 2.5"
  140.     Dim newgrid As New Form2
  141.     newgrid.Show
  142. End Sub
  143. Private Sub Command11_Click()
  144.     MydbName = App.Path & "\TRITON.MDB"
  145.     MyrcSource = "SELECT Min(SL.Quantity * RT.Retail) As Minsls, "
  146.     MyrcSource = MyrcSource + "Max(SL.Quantity * RT.Retail) As Maxsls, "
  147.     MyrcSource = MyrcSource + "Avg(SL.Quantity * RT.Retail) As Avgsls, "
  148.     MyrcSource = MyrcSource + "Sum(SL.Quantity * RT.Retail) As Totsls, "
  149.     MyrcSource = MyrcSource + "Sum(SL.Quantity) As Totvol "
  150.     MyrcSource = MyrcSource + "FROM Sales As SL, [Retail Items] As RT "
  151.     MyrcSource = MyrcSource + "WHERE SL.[Item Code] = RT.[Item Code]"
  152.     Dim newgrid As New Form2
  153.     newgrid.Show
  154. End Sub
  155. Private Sub Command12_Click()
  156.     MydbName = App.Path & "\TRITON.MDB"
  157.     MyrcSource = "SELECT SL.SalesID, Min(SL.Quantity * RT.Retail) As Minsls, "
  158.     MyrcSource = MyrcSource + "Max(SL.Quantity * RT.Retail) As Maxsls, "
  159.     MyrcSource = MyrcSource + "Avg(SL.Quantity * RT.Retail) As Avgsls, "
  160.     MyrcSource = MyrcSource + "Sum(SL.Quantity * RT.Retail) As Totsls, "
  161.     MyrcSource = MyrcSource + "Sum(SL.Quantity) As Totvol "
  162.     MyrcSource = MyrcSource + "FROM Sales As SL, [Retail Items] As RT "
  163.     MyrcSource = MyrcSource + "WHERE SL.[Item Code] = RT.[Item Code]"
  164.     MyrcSource = MyrcSource + " GROUP BY SL.SalesID"
  165.     Dim newgrid As New Form2
  166.     newgrid.Show
  167. End Sub
  168. Private Sub Command13_Click()
  169.     MydbName = App.Path & "\TRITON.MDB"
  170.     MyrcSource = "SELECT SL.SalesID, Min(SL.Quantity * RT.Retail) As Minsls, "
  171.     MyrcSource = MyrcSource + "Max(SL.Quantity * RT.Retail) As Maxsls, "
  172.     MyrcSource = MyrcSource + "Avg(SL.Quantity * RT.Retail) As Avgsls, "
  173.     MyrcSource = MyrcSource + "Sum(SL.Quantity * RT.Retail) As Totsls, "
  174.     MyrcSource = MyrcSource + "Sum(SL.Quantity) As Totvol "
  175.     MyrcSource = MyrcSource + "FROM Sales As SL, [Retail Items] As RT "
  176.     MyrcSource = MyrcSource + "WHERE SL.[Item Code] = RT.[Item Code]"
  177.     MyrcSource = MyrcSource + " GROUP BY SL.SalesID "
  178.     MyrcSource = MyrcSource + "HAVING Sum(SL.Quantity * RT.Retail) > 3000"
  179.     Dim newgrid As New Form2
  180.     newgrid.Show
  181. End Sub
  182. Private Sub Command14_Click()
  183.     MydbName = App.Path & "\TRITON.MDB"
  184.     MyrcSource = "SELECT * FROM Customers ORDER BY Lastname DESC, Firstname"
  185.     Dim newgrid As New Form2
  186.     newgrid.Show
  187. End Sub
  188. Private Sub Command2_Click()
  189.     MydbName = App.Path & "\TRITON.MDB"
  190.     MyrcSource = "SELECT [Item Code], Quantity FROM Sales"
  191.     Dim newgrid As New Form2
  192.     newgrid.Show
  193. End Sub
  194. Private Sub Command3_Click()
  195.     MydbName = App.Path & "\TRITON.MDB"
  196.     MyrcSource = "SELECT Sales.*, [Retail Items].[Item Description],"
  197.     MyrcSource = MyrcSource + "[Retail Items].Retail FROM Sales, [Retail Items]"
  198.     MyrcSource = MyrcSource + " WHERE Sales.[Item Code]=[Retail Items].[Item Code]"
  199.     Dim newgrid As New Form2
  200.     newgrid.Show
  201. End Sub
  202. Private Sub Command4_Click()
  203.     MydbName = App.Path & "\TRITON.MDB"
  204.     MyrcSource = "SELECT Lastname & ', ' & Firstname FROM Customers"
  205.     Dim newgrid As New Form2
  206.     newgrid.Show
  207. End Sub
  208. Private Sub Command5_Click()
  209.     MydbName = App.Path & "\TRITON.MDB"
  210.     MyrcSource = "SELECT CS.Lastname, CS.Firstname, SL.Saleslast, "
  211.     MyrcSource = MyrcSource + "SL.Salesfirst FROM Customers As CS, Salesmen"
  212.     MyrcSource = MyrcSource + " As SL, CS INNER JOIN SL ON CS.SalesID = "
  213.     MyrcSource = MyrcSource + "SL.SalesID"
  214.     Dim newgrid As New Form2
  215.     newgrid.Show
  216. End Sub
  217. Private Sub Command6_Click()
  218.     MydbName = App.Path & "\TRITON.MDB"
  219.     MyrcSource = "SELECT CS.Lastname, CS.Firstname, SL.Saleslast, "
  220.     MyrcSource = MyrcSource + "SL.Salesfirst FROM Customers As CS, Salesmen"
  221.     MyrcSource = MyrcSource + " As SL WHERE CS.SalesID = "
  222.     MyrcSource = MyrcSource + "SL.SalesID"
  223.     Dim newgrid As New Form2
  224.     newgrid.Show
  225. End Sub
  226. Private Sub Command7_Click()
  227.     MydbName = App.Path & "\TRITON.MDB"
  228.     MyrcSource = "SELECT * FROM [Retail Items] WHERE Retail < 2"
  229.     Dim newgrid As New Form2
  230.     newgrid.Show
  231. End Sub
  232. Private Sub Command8_Click()
  233.     MydbName = App.Path & "\TRITON.MDB"
  234.     MyrcSource = "SELECT * FROM Customers WHERE Lastname LIKE 'A*'"
  235.     Dim newgrid As New Form2
  236.     newgrid.Show
  237. End Sub
  238. Private Sub Command9_Click()
  239.     MydbName = App.Path & "\TRITON.MDB"
  240.     MyrcSource = "SELECT * FROM Customers WHERE State IN ('AL', 'FL', 'GA')"
  241.     Dim newgrid As New Form2
  242.     newgrid.Show
  243. End Sub
  244. Private Sub Form_Load()
  245.     Me.Height = 4905
  246.     Me.Width = 7710
  247.     Me.TOP = 100
  248.     Me.Left = 100
  249. End Sub
  250.