home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmProductType
- BorderStyle = 3 'Fixed Dialog
- Caption = "Product Type"
- ClientHeight = 2895
- ClientLeft = 390
- ClientTop = 1755
- ClientWidth = 7650
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 2895
- ScaleWidth = 7650
- ShowInTaskbar = 0 'False
- Tag = "Product Type"
- Begin VB.CommandButton cmdClose
- Cancel = -1 'True
- Caption = "&Close"
- Default = -1 'True
- Height = 300
- Left = 5520
- TabIndex = 13
- Top = 2175
- Width = 975
- End
- Begin VB.CommandButton cmdGrid
- Caption = "&Grid"
- Height = 300
- Left = 4440
- TabIndex = 12
- Tag = "&Grid"
- Top = 2175
- Width = 975
- End
- Begin VB.CommandButton cmdUpdate
- Caption = "&Update"
- Height = 300
- Left = 3360
- TabIndex = 11
- Tag = "&Update"
- Top = 2175
- Width = 975
- End
- Begin VB.CommandButton cmdRefresh
- Caption = "&Refresh"
- Height = 300
- Left = 2280
- TabIndex = 10
- Tag = "&Refresh"
- Top = 2175
- Width = 975
- End
- Begin VB.CommandButton cmdDelete
- Caption = "&Delete"
- Height = 300
- Left = 1200
- TabIndex = 9
- Tag = "&Delete"
- Top = 2175
- Width = 975
- End
- Begin VB.CommandButton cmdAdd
- Caption = "&Add"
- Height = 300
- Left = 120
- TabIndex = 8
- Tag = "&Add"
- Top = 2175
- Width = 975
- End
- Begin VB.Data Data1
- Align = 2 'Align Bottom
- Connect = "Access"
- DatabaseName = ""
- DefaultCursorType= 0 'DefaultCursor
- DefaultType = 2 'UseODBC
- Exclusive = 0 'False
- Height = 345
- Left = 0
- Options = 0
- ReadOnly = 0 'False
- RecordsetType = 1 'Dynaset
- RecordSource = "Product Type"
- Top = 2550
- Width = 7650
- End
- Begin VB.TextBox txtFields
- DataField = "Description"
- DataSource = "Data1"
- Height = 1155
- Index = 2
- Left = 120
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 5
- Top = 915
- Width = 4440
- End
- Begin VB.TextBox txtFields
- DataField = "Product Type Name"
- DataSource = "Data1"
- Height = 285
- Index = 1
- Left = 1680
- MaxLength = 50
- TabIndex = 3
- Top = 360
- Width = 2880
- End
- Begin VB.TextBox txtFields
- DataField = "Product Type ID"
- DataSource = "Data1"
- Height = 285
- Index = 0
- Left = 1680
- TabIndex = 1
- Top = 40
- Width = 1440
- End
- Begin VB.OLE oleFields
- DataField = "Picture"
- DataSource = "Data1"
- Height = 1710
- Index = 3
- Left = 4665
- OLETypeAllowed = 1 'Embedded
- SizeMode = 3 'Zoom
- TabIndex = 7
- Top = 360
- Width = 2880
- End
- Begin VB.Label lblLabels
- Caption = "Picture:"
- Height = 255
- Index = 3
- Left = 4665
- TabIndex = 6
- Tag = "Picture:"
- Top = 60
- Width = 1560
- End
- Begin VB.Label lblLabels
- Caption = "Description:"
- Height = 255
- Index = 2
- Left = 120
- TabIndex = 4
- Tag = "Description:"
- Top = 690
- Width = 1560
- End
- Begin VB.Label lblLabels
- Caption = "Product Type Name:"
- Height = 255
- Index = 1
- Left = 120
- TabIndex = 2
- Tag = "Product Type Name:"
- Top = 375
- Width = 1560
- End
- Begin VB.Label lblLabels
- Caption = "Product Type ID:"
- Height = 255
- Index = 0
- Left = 120
- TabIndex = 0
- Tag = "Product Type ID:"
- Top = 60
- Width = 1560
- End
- Attribute VB_Name = "frmProductType"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub cmdAdd_Click()
- Data1.Recordset.AddNew
- End Sub
- Private Sub cmdClose_Click()
- Me.Hide
- End Sub
- Private Sub cmdDelete_Click()
- 'this may produce an error if you delete the last
- 'record or the only record in the recordset
- With Data1.Recordset
- .Delete
- .MoveNext
- If .EOF Then .MoveLast
- End With
- End Sub
- Private Sub cmdRefresh_Click()
- 'this is really only needed for multi user apps
- Data1.Refresh
- End Sub
- Private Sub cmdUpdate_Click()
- Data1.UpdateRecord
- Data1.Recordset.Bookmark = Data1.Recordset.LastModified
- End Sub
- Private Sub cmdGrid_Click()
- On Error GoTo cmdGrid_ClickErr
- Dim f As New frmDataGrid
- Set f.Data1.Recordset = Data1.Recordset
- f.Caption = Me.Caption & " Grid"
- f.Show
- Exit Sub
- cmdGrid_ClickErr:
- End Sub
- Private Sub Data1_Error(DataErr As Integer, Response As Integer)
- 'This is where you would put error handling code
- 'If you want to ignore errors, comment out the next line
- 'If you want to trap them, add code here to handle them
- MsgBox "Data error event hit err:" & Error$(DataErr)
- Response = 0 'throw away the error
- End Sub
- Private Sub Data1_Reposition()
- Screen.MousePointer = vbDefault
- On Error Resume Next
- 'This will display the current record position
- 'for dynasets and snapshots
- Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1)
- 'for the table object you must set the index property when
- 'the recordset gets created and use the following line
- 'Data1.Caption = "Record: " & (Data1.Recordset.RecordCount * (Data1.Recordset.PercentPosition * 0.01)) + 1
- End Sub
- Private Sub Data1_Validate(Action As Integer, Save As Integer)
- 'This is where you put validation code
- 'This event gets called when the following actions occur
- Select Case Action
- Case vbDataActionMoveFirst
- Case vbDataActionMovePrevious
- Case vbDataActionMoveNext
- Case vbDataActionMoveLast
- Case vbDataActionAddNew
- Case vbDataActionUpdate
- Case vbDataActionDelete
- Case vbDataActionFind
- Case vbDataActionBookmark
- Case vbDataActionClose
- Screen.MousePointer = vbDefault
- End Select
- Screen.MousePointer = vbHourglass
- End Sub
- Private Sub Form_Load()
- Center Me
- Me.Data1.DatabaseName = frmMain.gsDatabase
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- Screen.MousePointer = vbDefault
- End Sub
- Private Sub oleFields_DblClick(Index As Integer)
- 'this is the way to get data into an empty ole control
- 'and have it saved back to the table
- oleFields(Index).InsertObjDlg
- End Sub
-