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 < prev    next >
Text File  |  1995-08-15  |  9KB  |  281 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. End
  129. Attribute VB_Name = "Form1"
  130. Attribute VB_Creatable = False
  131. Attribute VB_Exposed = False
  132.  
  133. Private Sub Command1_Click()
  134.     MydbName = App.Path & "\TRITON.MDB"
  135.     MyrcSource = "SELECT * FROM Sales"
  136.     Dim newgrid As New Form2
  137.     newgrid.Show
  138. End Sub
  139.  
  140. Private Sub Command10_Click()
  141.     MydbName = App.Path & "\TRITON.MDB"
  142.     MyrcSource = "SELECT * FROM [Retail Items] WHERE Retail BETWEEN 1 AND 2.5"
  143.     Dim newgrid As New Form2
  144.     newgrid.Show
  145. End Sub
  146.  
  147. Private Sub Command11_Click()
  148.     MydbName = App.Path & "\TRITON.MDB"
  149.     MyrcSource = "SELECT Min(SL.Quantity * RT.Retail) As Minsls, "
  150.     MyrcSource = MyrcSource + "Max(SL.Quantity * RT.Retail) As Maxsls, "
  151.     MyrcSource = MyrcSource + "Avg(SL.Quantity * RT.Retail) As Avgsls, "
  152.     MyrcSource = MyrcSource + "Sum(SL.Quantity * RT.Retail) As Totsls, "
  153.     MyrcSource = MyrcSource + "Sum(SL.Quantity) As Totvol "
  154.     MyrcSource = MyrcSource + "FROM Sales As SL, [Retail Items] As RT "
  155.     MyrcSource = MyrcSource + "WHERE SL.[Item Code] = RT.[Item Code]"
  156.     Dim newgrid As New Form2
  157.     newgrid.Show
  158. End Sub
  159.  
  160. Private Sub Command12_Click()
  161.     MydbName = App.Path & "\TRITON.MDB"
  162.     MyrcSource = "SELECT SL.SalesID, Min(SL.Quantity * RT.Retail) As Minsls, "
  163.     MyrcSource = MyrcSource + "Max(SL.Quantity * RT.Retail) As Maxsls, "
  164.     MyrcSource = MyrcSource + "Avg(SL.Quantity * RT.Retail) As Avgsls, "
  165.     MyrcSource = MyrcSource + "Sum(SL.Quantity * RT.Retail) As Totsls, "
  166.     MyrcSource = MyrcSource + "Sum(SL.Quantity) As Totvol "
  167.     MyrcSource = MyrcSource + "FROM Sales As SL, [Retail Items] As RT "
  168.     MyrcSource = MyrcSource + "WHERE SL.[Item Code] = RT.[Item Code]"
  169.     MyrcSource = MyrcSource + " GROUP BY SL.SalesID"
  170.     Dim newgrid As New Form2
  171.     newgrid.Show
  172. End Sub
  173.  
  174. Private Sub Command13_Click()
  175.     MydbName = App.Path & "\TRITON.MDB"
  176.     MyrcSource = "SELECT SL.SalesID, Min(SL.Quantity * RT.Retail) As Minsls, "
  177.     MyrcSource = MyrcSource + "Max(SL.Quantity * RT.Retail) As Maxsls, "
  178.     MyrcSource = MyrcSource + "Avg(SL.Quantity * RT.Retail) As Avgsls, "
  179.     MyrcSource = MyrcSource + "Sum(SL.Quantity * RT.Retail) As Totsls, "
  180.     MyrcSource = MyrcSource + "Sum(SL.Quantity) As Totvol "
  181.     MyrcSource = MyrcSource + "FROM Sales As SL, [Retail Items] As RT "
  182.     MyrcSource = MyrcSource + "WHERE SL.[Item Code] = RT.[Item Code]"
  183.     MyrcSource = MyrcSource + " GROUP BY SL.SalesID "
  184.     MyrcSource = MyrcSource + "HAVING Sum(SL.Quantity * RT.Retail) > 3000"
  185.     Dim newgrid As New Form2
  186.     newgrid.Show
  187. End Sub
  188.  
  189. Private Sub Command14_Click()
  190.     MydbName = App.Path & "\TRITON.MDB"
  191.     MyrcSource = "SELECT * FROM Customers ORDER BY Lastname DESC, Firstname"
  192.     Dim newgrid As New Form2
  193.     newgrid.Show
  194. End Sub
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201. Private Sub Command2_Click()
  202.     MydbName = App.Path & "\TRITON.MDB"
  203.     MyrcSource = "SELECT [Item Code], Quantity FROM Sales"
  204.     Dim newgrid As New Form2
  205.     newgrid.Show
  206. End Sub
  207.  
  208. Private Sub Command3_Click()
  209.     MydbName = App.Path & "\TRITON.MDB"
  210.     MyrcSource = "SELECT Sales.*, [Retail Items].[Item Description],"
  211.     MyrcSource = MyrcSource + "[Retail Items].Retail FROM Sales, [Retail Items]"
  212.     MyrcSource = MyrcSource + " WHERE Sales.[Item Code]=[Retail Items].[Item Code]"
  213.     Dim newgrid As New Form2
  214.     newgrid.Show
  215. End Sub
  216.  
  217. Private Sub Command4_Click()
  218.     MydbName = App.Path & "\TRITON.MDB"
  219.     MyrcSource = "SELECT Lastname & ', ' & Firstname FROM Customers"
  220.     Dim newgrid As New Form2
  221.     newgrid.Show
  222. End Sub
  223.  
  224. Private Sub Command5_Click()
  225.     MydbName = App.Path & "\TRITON.MDB"
  226.     MyrcSource = "SELECT CS.Lastname, CS.Firstname, SL.Saleslast, "
  227.     MyrcSource = MyrcSource + "SL.Salesfirst FROM Customers As CS, Salesmen"
  228.     MyrcSource = MyrcSource + " As SL, CS INNER JOIN SL ON CS.SalesID = "
  229.     MyrcSource = MyrcSource + "SL.SalesID"
  230.     Dim newgrid As New Form2
  231.     newgrid.Show
  232. End Sub
  233.  
  234. Private Sub Command6_Click()
  235.     MydbName = App.Path & "\TRITON.MDB"
  236.     MyrcSource = "SELECT CS.Lastname, CS.Firstname, SL.Saleslast, "
  237.     MyrcSource = MyrcSource + "SL.Salesfirst FROM Customers As CS, Salesmen"
  238.     MyrcSource = MyrcSource + " As SL WHERE CS.SalesID = "
  239.     MyrcSource = MyrcSource + "SL.SalesID"
  240.     Dim newgrid As New Form2
  241.     newgrid.Show
  242. End Sub
  243.  
  244. Private Sub Command7_Click()
  245.     MydbName = App.Path & "\TRITON.MDB"
  246.     MyrcSource = "SELECT * FROM [Retail Items] WHERE Retail < 2"
  247.     Dim newgrid As New Form2
  248.     newgrid.Show
  249. End Sub
  250.  
  251. Private Sub Command8_Click()
  252.     MydbName = App.Path & "\TRITON.MDB"
  253.     MyrcSource = "SELECT * FROM Customers WHERE Lastname LIKE 'A*'"
  254.     Dim newgrid As New Form2
  255.     newgrid.Show
  256. End Sub
  257.  
  258. Private Sub Command9_Click()
  259.     MydbName = App.Path & "\TRITON.MDB"
  260.     MyrcSource = "SELECT * FROM Customers WHERE State IN ('AL', 'FL', 'GA')"
  261.     Dim newgrid As New Form2
  262.     newgrid.Show
  263. End Sub
  264.  
  265. Private Sub Form_Load()
  266.     Me.Height = 4905
  267.     Me.Width = 7710
  268.     Me.TOP = 100
  269.     Me.Left = 100
  270. End Sub
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.