home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form BrwDemo
- BorderStyle = 1 'Fixed Single
- Caption = "Product Groups"
- ClientHeight = 4980
- ClientLeft = 870
- ClientTop = 1290
- ClientWidth = 5280
- Height = 5505
- Left = 810
- MaxButton = 0 'False
- ScaleHeight = 4980
- ScaleWidth = 5280
- Top = 825
- Width = 5400
- Begin CommandButton comProducts
- Caption = "&Products"
- Height = 372
- Left = 3960
- TabIndex = 9
- Top = 120
- Width = 1212
- End
- Begin TextBox txtEdt
- DataField = "DESCR"
- DataSource = "dtaPrdGroup"
- Height = 288
- Index = 3
- Left = 1320
- TabIndex = 8
- Top = 1200
- Width = 3852
- End
- Begin TextBox txtEdt
- DataField = "TYPE"
- DataSource = "dtaPrdGroup"
- Enabled = 0 'False
- Height = 288
- Index = 2
- Left = 1320
- TabIndex = 6
- Top = 840
- Width = 1092
- End
- Begin TextBox txtEdt
- DataField = "CODE"
- DataSource = "dtaPrdGroup"
- Enabled = 0 'False
- Height = 288
- Index = 1
- Left = 1320
- TabIndex = 4
- Top = 480
- Width = 1092
- End
- Begin TextBox txtEdt
- DataField = "GROUP"
- DataSource = "dtaPrdGroup"
- Enabled = 0 'False
- Height = 288
- Index = 0
- Left = 1320
- TabIndex = 2
- Top = 120
- Width = 1092
- End
- Begin TBrowse Brw
- BorderStyle = 0 'None
- DataSource = "dtaPrdGroup"
- Height = 2892
- Left = 120
- TabIndex = 0
- Top = 1560
- Width = 5052
- End
- Begin Data dtaPrdGroup
- Caption = "Product Group Data Control"
- Connect = ""
- DatabaseName = "C:\VB\CDK\BRWA\DEMO\DEMO.MDB"
- Exclusive = 0 'False
- Height = 372
- Left = 120
- Options = 0
- ReadOnly = 0 'False
- RecordSource = "PRDGRP"
- Top = 4560
- Width = 5052
- End
- Begin Label Label1
- Caption = "&Description:"
- Height = 252
- Index = 3
- Left = 120
- TabIndex = 7
- Top = 1200
- Width = 1092
- End
- Begin Label Label1
- Caption = "&Type:"
- Height = 252
- Index = 2
- Left = 120
- TabIndex = 5
- Top = 840
- Width = 1092
- End
- Begin Label Label1
- Caption = "&Code:"
- Height = 252
- Index = 1
- Left = 120
- TabIndex = 3
- Top = 480
- Width = 1092
- End
- Begin Label Label1
- Caption = "&Group:"
- Height = 252
- Index = 0
- Left = 120
- TabIndex = 1
- Top = 120
- Width = 1092
- End
- Option Explicit
- ' lInitialize is required as a one time flag,
- ' see form_activate() for details
- Dim lInitialize As Integer
- Sub Brw_Change (nRowCol As Integer)
- Dim cFind As String
- ' reposition the browse control in the frmCatalog
- ' if the form is visible
- ' The 2 databases are related by GROUP+CODE+TYPE
- If frmCatalog.Visible Then
- cFind = "GROUP = '" + dtaPrdGroup.Recordset.Fields("GROUP").Value + "' and "
- cFind = cFind + "CODE = '" + dtaPrdGroup.Recordset.Fields("CODE").Value + "' and "
- cFind = cFind + "TYPE = '" + dtaPrdGroup.Recordset.Fields("TYPE").Value + "'"
- frmCatalog!dtaCatalog.Recordset.FindFirst cFind
- End If
- End Sub
- Sub Brw_EditValid (nCol As Integer, cField As String, lOk As Integer)
- ' no validation is required, only the product
- ' group description is editable
- End Sub
- Sub comProducts_Click ()
- ' activate the frmCatalog - the other form
- frmCatalog.Show
- comProducts.Enabled = False
- End Sub
- Sub Form_Activate ()
- ' We need to force the data control to move to
- ' the first record, after the form has been
- ' loaded (but not in form_load(), the objects
- ' are not yet initialized ).
- ' This must be done also if the RecordSource
- ' changes at run-time
- If Not lInitialize Then
- lInitialize = True
- dtaPrdGroup.Recordset.MoveFirst
- End If
- End Sub
- Sub Form_Load ()
- Me.Top = 0: Me.Left = 0
- ' initialize the Browse control
- Brw.Cols = 4 ' we need four columns
- ' set columns data width
- Brw.ColWidth(0) = 4
- Brw.ColWidth(1) = 4
- Brw.ColWidth(2) = 4
- Brw.ColWidth(3) = 50
- ' set column headers - defaults are the field names
- Brw.Header(0) = "Group"
- Brw.Header(1) = "Code"
- Brw.Header(2) = "Type"
- Brw.Header(3) = "Description"
- ' set the data field for each column
- Brw.ColField(0) = "GROUP"
- Brw.ColField(1) = "CODE"
- Brw.ColField(2) = "TYPE"
- Brw.ColField(3) = "DESCR"
- Brw.LeftFrozen = 1 ' freeze the GROUP (column 0) to the left
- Brw.ColEdit(3) = True ' enable editing only for the last column
- Load frmCatalog ' load the other form, but do not show it
- End Sub
- Sub Form_Unload (Cancel As Integer)
- ' we are exiting, unload the frmCatalog
- Unload frmCatalog
- End Sub
-