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 >
Wrap
Text File
|
1995-08-15
|
9KB
|
281 lines
VERSION 4.00
Begin VB.Form Form1
Caption = "SQL Commands from Chapter 6 Listings"
ClientHeight = 4440
ClientLeft = 1110
ClientTop = 2010
ClientWidth = 7530
Height = 4905
Left = 1020
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 4440
ScaleWidth = 7530
Top = 1635
Width = 7710
Begin VB.CommandButton Command14
Caption = "Listing 6.17"
Height = 375
Left = 4560
TabIndex = 13
Top = 2040
Width = 2295
End
Begin VB.CommandButton Command13
Caption = "Listing 6.20"
Height = 375
Left = 4560
TabIndex = 12
Top = 3840
Width = 2295
End
Begin VB.CommandButton Command12
Caption = "Listing 6.19"
Height = 375
Left = 4560
TabIndex = 11
Top = 3240
Width = 2295
End
Begin VB.CommandButton Command11
Caption = "Listing 6.18"
Height = 375
Left = 4560
TabIndex = 10
Top = 2640
Width = 2295
End
Begin VB.CommandButton Command10
Caption = "Listing 6.15"
Height = 375
Left = 4560
TabIndex = 9
Top = 1440
Width = 2295
End
Begin VB.CommandButton Command9
Caption = "Listing 6.14"
Height = 375
Left = 4560
TabIndex = 8
Top = 840
Width = 2295
End
Begin VB.CommandButton Command8
Caption = "Listing 6.13"
Height = 375
Left = 4560
TabIndex = 7
Top = 240
Width = 2295
End
Begin VB.CommandButton Command7
Caption = "Listing 6.12 (Numeric)"
Height = 375
Left = 720
TabIndex = 6
Top = 3840
Width = 2295
End
Begin VB.CommandButton Command6
Caption = "Listing 6.11"
Height = 375
Left = 720
TabIndex = 5
Top = 3240
Width = 2295
End
Begin VB.CommandButton Command5
Caption = "Listing 6.10 (Inner Join)"
Height = 375
Left = 720
TabIndex = 4
Top = 2640
Width = 2295
End
Begin VB.CommandButton Command4
Caption = "Listing 6.4 (Partial)"
Height = 375
Left = 720
TabIndex = 3
Top = 2040
Width = 2295
End
Begin VB.CommandButton Command3
Caption = "Listing 6.3"
Height = 375
Left = 720
TabIndex = 2
Top = 1440
Width = 2295
End
Begin VB.CommandButton Command2
Caption = "Listing 6.2"
Height = 375
Left = 720
TabIndex = 1
Top = 840
Width = 2295
End
Begin VB.CommandButton Command1
Caption = "Listing 6.1"
Height = 375
Left = 720
TabIndex = 0
Top = 240
Width = 2295
End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Private Sub Command1_Click()
MydbName = App.Path & "\TRITON.MDB"
MyrcSource = "SELECT * FROM Sales"
Dim newgrid As New Form2
newgrid.Show
End Sub
Private Sub Command10_Click()
MydbName = App.Path & "\TRITON.MDB"
MyrcSource = "SELECT * FROM [Retail Items] WHERE Retail BETWEEN 1 AND 2.5"
Dim newgrid As New Form2
newgrid.Show
End Sub
Private Sub Command11_Click()
MydbName = App.Path & "\TRITON.MDB"
MyrcSource = "SELECT Min(SL.Quantity * RT.Retail) As Minsls, "
MyrcSource = MyrcSource + "Max(SL.Quantity * RT.Retail) As Maxsls, "
MyrcSource = MyrcSource + "Avg(SL.Quantity * RT.Retail) As Avgsls, "
MyrcSource = MyrcSource + "Sum(SL.Quantity * RT.Retail) As Totsls, "
MyrcSource = MyrcSource + "Sum(SL.Quantity) As Totvol "
MyrcSource = MyrcSource + "FROM Sales As SL, [Retail Items] As RT "
MyrcSource = MyrcSource + "WHERE SL.[Item Code] = RT.[Item Code]"
Dim newgrid As New Form2
newgrid.Show
End Sub
Private Sub Command12_Click()
MydbName = App.Path & "\TRITON.MDB"
MyrcSource = "SELECT SL.SalesID, Min(SL.Quantity * RT.Retail) As Minsls, "
MyrcSource = MyrcSource + "Max(SL.Quantity * RT.Retail) As Maxsls, "
MyrcSource = MyrcSource + "Avg(SL.Quantity * RT.Retail) As Avgsls, "
MyrcSource = MyrcSource + "Sum(SL.Quantity * RT.Retail) As Totsls, "
MyrcSource = MyrcSource + "Sum(SL.Quantity) As Totvol "
MyrcSource = MyrcSource + "FROM Sales As SL, [Retail Items] As RT "
MyrcSource = MyrcSource + "WHERE SL.[Item Code] = RT.[Item Code]"
MyrcSource = MyrcSource + " GROUP BY SL.SalesID"
Dim newgrid As New Form2
newgrid.Show
End Sub
Private Sub Command13_Click()
MydbName = App.Path & "\TRITON.MDB"
MyrcSource = "SELECT SL.SalesID, Min(SL.Quantity * RT.Retail) As Minsls, "
MyrcSource = MyrcSource + "Max(SL.Quantity * RT.Retail) As Maxsls, "
MyrcSource = MyrcSource + "Avg(SL.Quantity * RT.Retail) As Avgsls, "
MyrcSource = MyrcSource + "Sum(SL.Quantity * RT.Retail) As Totsls, "
MyrcSource = MyrcSource + "Sum(SL.Quantity) As Totvol "
MyrcSource = MyrcSource + "FROM Sales As SL, [Retail Items] As RT "
MyrcSource = MyrcSource + "WHERE SL.[Item Code] = RT.[Item Code]"
MyrcSource = MyrcSource + " GROUP BY SL.SalesID "
MyrcSource = MyrcSource + "HAVING Sum(SL.Quantity * RT.Retail) > 3000"
Dim newgrid As New Form2
newgrid.Show
End Sub
Private Sub Command14_Click()
MydbName = App.Path & "\TRITON.MDB"
MyrcSource = "SELECT * FROM Customers ORDER BY Lastname DESC, Firstname"
Dim newgrid As New Form2
newgrid.Show
End Sub
Private Sub Command2_Click()
MydbName = App.Path & "\TRITON.MDB"
MyrcSource = "SELECT [Item Code], Quantity FROM Sales"
Dim newgrid As New Form2
newgrid.Show
End Sub
Private Sub Command3_Click()
MydbName = App.Path & "\TRITON.MDB"
MyrcSource = "SELECT Sales.*, [Retail Items].[Item Description],"
MyrcSource = MyrcSource + "[Retail Items].Retail FROM Sales, [Retail Items]"
MyrcSource = MyrcSource + " WHERE Sales.[Item Code]=[Retail Items].[Item Code]"
Dim newgrid As New Form2
newgrid.Show
End Sub
Private Sub Command4_Click()
MydbName = App.Path & "\TRITON.MDB"
MyrcSource = "SELECT Lastname & ', ' & Firstname FROM Customers"
Dim newgrid As New Form2
newgrid.Show
End Sub
Private Sub Command5_Click()
MydbName = App.Path & "\TRITON.MDB"
MyrcSource = "SELECT CS.Lastname, CS.Firstname, SL.Saleslast, "
MyrcSource = MyrcSource + "SL.Salesfirst FROM Customers As CS, Salesmen"
MyrcSource = MyrcSource + " As SL, CS INNER JOIN SL ON CS.SalesID = "
MyrcSource = MyrcSource + "SL.SalesID"
Dim newgrid As New Form2
newgrid.Show
End Sub
Private Sub Command6_Click()
MydbName = App.Path & "\TRITON.MDB"
MyrcSource = "SELECT CS.Lastname, CS.Firstname, SL.Saleslast, "
MyrcSource = MyrcSource + "SL.Salesfirst FROM Customers As CS, Salesmen"
MyrcSource = MyrcSource + " As SL WHERE CS.SalesID = "
MyrcSource = MyrcSource + "SL.SalesID"
Dim newgrid As New Form2
newgrid.Show
End Sub
Private Sub Command7_Click()
MydbName = App.Path & "\TRITON.MDB"
MyrcSource = "SELECT * FROM [Retail Items] WHERE Retail < 2"
Dim newgrid As New Form2
newgrid.Show
End Sub
Private Sub Command8_Click()
MydbName = App.Path & "\TRITON.MDB"
MyrcSource = "SELECT * FROM Customers WHERE Lastname LIKE 'A*'"
Dim newgrid As New Form2
newgrid.Show
End Sub
Private Sub Command9_Click()
MydbName = App.Path & "\TRITON.MDB"
MyrcSource = "SELECT * FROM Customers WHERE State IN ('AL', 'FL', 'GA')"
Dim newgrid As New Form2
newgrid.Show
End Sub
Private Sub Form_Load()
Me.Height = 4905
Me.Width = 7710
Me.TOP = 100
Me.Left = 100
End Sub