VERSION 5.00

Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"

Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"

Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"

Begin VB.Form Form1

Caption = "Form1"

ClientHeight = 3195

ClientLeft = 60

ClientTop = 345

ClientWidth = 8640

LinkTopic = "Form1"

ScaleHeight = 3195

ScaleWidth = 8640

StartUpPosition = 3 'Windows Default

Begin VB.TextBox Text1

DataField = "CompanyName"

DataSource = "Adodc1"

Height = 615

Left = 840

TabIndex = 10

Text = "Text1"

Top = 4080

Width = 3015

End

Begin MSHierarchicalFlexGridLib.MSHFlexGrid MSHFlexGrid1

Bindings = "adodemo.frx":0000

Height = 1935

Left = 3480

TabIndex = 8

Top = 1680

Visible = 0 'False

Width = 5775

_ExtentX = 10186

_ExtentY = 3413

_Version = 393216

FixedCols = 0

AllowUserResizing= 3

RowSizingMode = 1

_NumberOfBands = 1

_Band(0).Cols = 2

End

Begin MSDataListLib.DataList DataList1

Bindings = "adodemo.frx":0015

DataSource = "Adodc2"

Height = 1425

Left = 120

TabIndex = 5

Top = 1920

Width = 3015

_ExtentX = 5318

_ExtentY = 2514

_Version = 393216

ListField = "OrderID"

BoundColumn = "OrderID"

End

Begin MSAdodcLib.Adodc Adodc3

Height = 375

Left = 5880

Top = 120

Visible = 0 'False

Width = 2175

_ExtentX = 3836

_ExtentY = 661

ConnectMode = 0

CursorLocation = 3

IsolationLevel = -1

ConnectionTimeout= 15

CommandTimeout = 30

CursorType = 3

LockType = 3

CommandType = 2

CursorOptions = 0

CacheSize = 50

MaxRecords = 0

BOFAction = 0

EOFAction = 0

ConnectStringType= 3

Appearance = 1

BackColor = -2147483643

ForeColor = -2147483640

Orientation = 0

Enabled = -1

Connect = "DSN=my"

OLEDBString = ""

OLEDBFile = ""

DataSourceName = "my"

OtherAttributes = ""

UserName = "sa"

Password = ""

RecordSource = "Customers"

Caption = "Adodc3"

BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}

Name = "MS Sans Serif"

Size = 8.25

Charset = 161

Weight = 400

Underline = 0 'False

Italic = 0 'False

Strikethrough = 0 'False

EndProperty

_Version = 393216

End

Begin MSAdodcLib.Adodc Adodc2

Height = 375

Left = 3480

Top = 120

Visible = 0 'False

Width = 2055

_ExtentX = 3625

_ExtentY = 661

ConnectMode = 0

CursorLocation = 3

IsolationLevel = -1

ConnectionTimeout= 15

CommandTimeout = 30

CursorType = 3

LockType = 3

CommandType = 2

CursorOptions = 0

CacheSize = 50

MaxRecords = 0

BOFAction = 0

EOFAction = 0

ConnectStringType= 3

Appearance = 1

BackColor = -2147483643

ForeColor = -2147483640

Orientation = 0

Enabled = -1

Connect = "DSN=my"

OLEDBString = ""

OLEDBFile = ""

DataSourceName = "my"

OtherAttributes = ""

UserName = "sa"

Password = ""

RecordSource = "Employees"

Caption = "Adodc2"

BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}

Name = "MS Sans Serif"

Size = 8.25

Charset = 161

Weight = 400

Underline = 0 'False

Italic = 0 'False

Strikethrough = 0 'False

EndProperty

_Version = 393216

End

Begin MSDataListLib.DataCombo DataCombo1

Bindings = "adodemo.frx":002A

Height = 315

Left = 6600

TabIndex = 4

Top = 960

Width = 2295

_ExtentX = 4048

_ExtentY = 556

_Version = 393216

ListField = "CustomerID"

Text = "Select one"

End

Begin MSDataListLib.DataCombo ContactNames

Bindings = "adodemo.frx":003F

Height = 315

Left = 3120

TabIndex = 2

Top = 960

Width = 3375

_ExtentX = 5953

_ExtentY = 556

_Version = 393216

ListField = "ContactName"

Text = "Select a contact name"

End

Begin MSDataListLib.DataCombo Companynames

Bindings = "adodemo.frx":0054

Height = 315

Left = 240

TabIndex = 0

Top = 960

Width = 2775

_ExtentX = 4895

_ExtentY = 556

_Version = 393216

ListField = "CompanyName"

Text = "Select a company name"

End

Begin MSAdodcLib.Adodc Adodc1

Height = 375

Left = 240

Top = 120

Visible = 0 'False

Width = 2775

_ExtentX = 4895

_ExtentY = 661

ConnectMode = 0

CursorLocation = 3

IsolationLevel = -1

ConnectionTimeout= 15

CommandTimeout = 30

CursorType = 3

LockType = 3

CommandType = 2

CursorOptions = 0

CacheSize = 50

MaxRecords = 0

BOFAction = 0

EOFAction = 0

ConnectStringType= 3

Appearance = 1

BackColor = -2147483643

ForeColor = -2147483640

Orientation = 0

Enabled = -1

Connect = "DSN=my"

OLEDBString = ""

OLEDBFile = ""

DataSourceName = "my"

OtherAttributes = ""

UserName = "sa"

Password = ""

RecordSource = "Customers"

Caption = "Adodc1"

BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}

Name = "MS Sans Serif"

Size = 8.25

Charset = 161

Weight = 400

Underline = 0 'False

Italic = 0 'False

Strikethrough = 0 'False

EndProperty

_Version = 393216

End

Begin VB.Label Label4

Caption = "OrderID"

Height = 375

Left = 360

TabIndex = 9

Top = 1440

Width = 2175

End

Begin VB.Label InvoiceTotal

Height = 255

Left = 3600

TabIndex = 7

Top = 1320

Width = 4815

End

Begin VB.Label Label3

Caption = "CustomerID"

Height = 255

Left = 6600

TabIndex = 6

Top = 720

Width = 2055

End

Begin VB.Label Label2

Caption = "Contact Name"

Height = 375

Left = 3120

TabIndex = 3

Top = 600

Width = 3255

End

Begin VB.Label Label1

Caption = "Company Name"

Height = 255

Left = 240

TabIndex = 1

Top = 600

Width = 2655

End

End

Attribute VB_Name = "Form1"

Attribute VB_GlobalNameSpace = False

Attribute VB_Creatable = False

Attribute VB_PredeclaredId = True

Attribute VB_Exposed = False

Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

Adodc2.CommandType = adCmdText

Adodc2.RecordSource = "SELECT OrderID" & " FROM Orders " & _

"WHERE Orders.CustomerID='" & _

Adodc1.Recordset.Fields("CustomerID") & "'"

Adodc2.Refresh

 

 

End Sub

 

 

Private Sub Companynames_Change()

On Error Resume Next

Adodc1.Recordset.Bookmark = Companynames.SelectedItem

On Error GoTo 0

End Sub

Private Sub ContactNames_Change()

On Error Resume Next

Adodc1.Recordset.Bookmark = ContactNames.SelectedItem

On Error GoTo 0

End Sub

Private Sub DataList1_Click()

MSHFlexGrid1.Visible = True

Adodc3.CommandType = adCmdText

Adodc3.RecordSource = "SELECT ProductName AS Item," & _

"Quantity AS QTY, Discount AS Disc," & _

" [Order Details].UnitPrice As Price," & _

" [Order Details].UnitPrice*Quantity" & _

" As LineTotal " & _

"FROM [Order Details], Products" & _

" WHERE [Order Details].ProductID=" & _

" Products.ProductID AND " & _

"OrderID=" & DataList1.Text

Rem MsgBox (Adodc3.RecordSource)

 

 

Adodc3.Refresh

While Not Adodc3.Recordset.EOF

Sum = Sum + _

Adodc3.Recordset.Fields("Price") * _

Adodc3.Recordset.Fields("QTY") * _

(1 - Adodc3.Recordset.Fields("Disc"))

Adodc3.Recordset.MoveNext

Wend

InvoiceTotal.Caption = _

"The total for Invoice # " & _

DataList1.Text & " is " & _

Format(Sum, "#,###.00")

 

 

End Sub