home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap14 / mast.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-10-07  |  8.0 KB  |  267 lines

  1. VERSION 4.00
  2. Begin VB.Form frmMast 
  3.    Caption         =   "Master"
  4.    ClientHeight    =   2955
  5.    ClientLeft      =   1110
  6.    ClientTop       =   1515
  7.    ClientWidth     =   5520
  8.    Height          =   3360
  9.    Left            =   1050
  10.    LinkTopic       =   "Form2"
  11.    ScaleHeight     =   2955
  12.    ScaleWidth      =   5520
  13.    Top             =   1170
  14.    Width           =   5640
  15.    Begin VB.CommandButton cmdClose 
  16.       Caption         =   "&Close"
  17.       Height          =   300
  18.       Left            =   4440
  19.       TabIndex        =   18
  20.       Top             =   2300
  21.       Width           =   975
  22.    End
  23.    Begin VB.CommandButton cmdUpdate 
  24.       Caption         =   "&Update"
  25.       Height          =   300
  26.       Left            =   3360
  27.       TabIndex        =   17
  28.       Top             =   2300
  29.       Width           =   975
  30.    End
  31.    Begin VB.CommandButton cmdRefresh 
  32.       Caption         =   "&Refresh"
  33.       Height          =   300
  34.       Left            =   2280
  35.       TabIndex        =   16
  36.       Top             =   2300
  37.       Width           =   975
  38.    End
  39.    Begin VB.CommandButton cmdDelete 
  40.       Caption         =   "&Delete"
  41.       Height          =   300
  42.       Left            =   1200
  43.       TabIndex        =   15
  44.       Top             =   2300
  45.       Width           =   975
  46.    End
  47.    Begin VB.CommandButton cmdAdd 
  48.       Caption         =   "&Add"
  49.       Height          =   300
  50.       Left            =   120
  51.       TabIndex        =   14
  52.       Top             =   2300
  53.       Width           =   975
  54.    End
  55.    Begin VB.Data Data1 
  56.       Align           =   2  'Align Bottom
  57.       Connect         =   ""
  58.       DatabaseName    =   "CH1402.MDB"
  59.       Exclusive       =   0   'False
  60.       Height          =   300
  61.       Left            =   0
  62.       Options         =   0
  63.       ReadOnly        =   0   'False
  64.       RecordsetType   =   1  'Dynaset
  65.       RecordSource    =   "Master"
  66.       Top             =   2655
  67.       Width           =   5520
  68.    End
  69.    Begin VB.TextBox txtFields 
  70.       DataField       =   "PostCode"
  71.       DataSource      =   "Data1"
  72.       Height          =   285
  73.       Index           =   6
  74.       Left            =   2040
  75.       MaxLength       =   15
  76.       TabIndex        =   13
  77.       Top             =   1960
  78.       Width           =   3375
  79.    End
  80.    Begin VB.TextBox txtFields 
  81.       DataField       =   "StProv"
  82.       DataSource      =   "Data1"
  83.       Height          =   285
  84.       Index           =   5
  85.       Left            =   2040
  86.       MaxLength       =   20
  87.       TabIndex        =   11
  88.       Top             =   1640
  89.       Width           =   3375
  90.    End
  91.    Begin VB.TextBox txtFields 
  92.       DataField       =   "City"
  93.       DataSource      =   "Data1"
  94.       Height          =   285
  95.       Index           =   4
  96.       Left            =   2040
  97.       MaxLength       =   20
  98.       TabIndex        =   9
  99.       Top             =   1320
  100.       Width           =   3375
  101.    End
  102.    Begin VB.TextBox txtFields 
  103.       DataField       =   "Addr2"
  104.       DataSource      =   "Data1"
  105.       Height          =   285
  106.       Index           =   3
  107.       Left            =   2040
  108.       MaxLength       =   30
  109.       TabIndex        =   7
  110.       Top             =   1000
  111.       Width           =   3375
  112.    End
  113.    Begin VB.TextBox txtFields 
  114.       DataField       =   "Addr1"
  115.       DataSource      =   "Data1"
  116.       Height          =   285
  117.       Index           =   2
  118.       Left            =   2040
  119.       MaxLength       =   30
  120.       TabIndex        =   5
  121.       Top             =   680
  122.       Width           =   3375
  123.    End
  124.    Begin VB.TextBox txtFields 
  125.       DataField       =   "CustName"
  126.       DataSource      =   "Data1"
  127.       Height          =   285
  128.       Index           =   1
  129.       Left            =   2040
  130.       MaxLength       =   30
  131.       TabIndex        =   3
  132.       Top             =   360
  133.       Width           =   3375
  134.    End
  135.    Begin VB.TextBox txtFields 
  136.       DataField       =   "CustID"
  137.       DataSource      =   "Data1"
  138.       Height          =   285
  139.       Index           =   0
  140.       Left            =   2040
  141.       MaxLength       =   10
  142.       TabIndex        =   1
  143.       Top             =   40
  144.       Width           =   3375
  145.    End
  146.    Begin VB.Label lblLabels 
  147.       Caption         =   "PostCode:"
  148.       Height          =   255
  149.       Index           =   6
  150.       Left            =   120
  151.       TabIndex        =   12
  152.       Top             =   1980
  153.       Width           =   1815
  154.    End
  155.    Begin VB.Label lblLabels 
  156.       Caption         =   "StProv:"
  157.       Height          =   255
  158.       Index           =   5
  159.       Left            =   120
  160.       TabIndex        =   10
  161.       Top             =   1660
  162.       Width           =   1815
  163.    End
  164.    Begin VB.Label lblLabels 
  165.       Caption         =   "City:"
  166.       Height          =   255
  167.       Index           =   4
  168.       Left            =   120
  169.       TabIndex        =   8
  170.       Top             =   1340
  171.       Width           =   1815
  172.    End
  173.    Begin VB.Label lblLabels 
  174.       Caption         =   "Addr2:"
  175.       Height          =   255
  176.       Index           =   3
  177.       Left            =   120
  178.       TabIndex        =   6
  179.       Top             =   1020
  180.       Width           =   1815
  181.    End
  182.    Begin VB.Label lblLabels 
  183.       Caption         =   "Addr1:"
  184.       Height          =   255
  185.       Index           =   2
  186.       Left            =   120
  187.       TabIndex        =   4
  188.       Top             =   700
  189.       Width           =   1815
  190.    End
  191.    Begin VB.Label lblLabels 
  192.       Caption         =   "CustName:"
  193.       Height          =   255
  194.       Index           =   1
  195.       Left            =   120
  196.       TabIndex        =   2
  197.       Top             =   380
  198.       Width           =   1815
  199.    End
  200.    Begin VB.Label lblLabels 
  201.       Caption         =   "CustID:"
  202.       Height          =   255
  203.       Index           =   0
  204.       Left            =   120
  205.       TabIndex        =   0
  206.       Top             =   60
  207.       Width           =   1815
  208.    End
  209. Attribute VB_Name = "frmMast"
  210. Attribute VB_Creatable = False
  211. Attribute VB_Exposed = False
  212. Option Explicit
  213. Private Sub cmdAdd_Click()
  214.   Data1.Recordset.AddNew
  215. End Sub
  216. Private Sub cmdDelete_Click()
  217.   'this may produce an error if you delete the last
  218.   'record or the only record in the recordset
  219.   Data1.Recordset.Delete
  220.   Data1.Recordset.MoveNext
  221. End Sub
  222. Private Sub cmdRefresh_Click()
  223.   'this is really only needed for multi user apps
  224.   Data1.Refresh
  225. End Sub
  226. Private Sub cmdUpdate_Click()
  227.   Data1.UpdateRecord
  228.   Data1.Recordset.Bookmark = Data1.Recordset.LastModified
  229. End Sub
  230. Private Sub cmdClose_Click()
  231.   Unload Me
  232. End Sub
  233. Private Sub Data1_Error(DataErr As Integer, Response As Integer)
  234.   'This is where you would put error handling code
  235.   'If you want to ignore errors, comment out the next line
  236.   'If you want to trap them, add code here to handle them
  237.   MsgBox "Data error event hit err:" & Error$(DataErr)
  238.   Response = 0  'throw away the error
  239. End Sub
  240. Private Sub Data1_Reposition()
  241.   Screen.MousePointer = vbDefault
  242.   On Error Resume Next
  243.   'This will display the current record position
  244.   'for dynasets and snapshots
  245.   Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1)
  246.   'for the table object you must set the index property when
  247.   'the recordset gets created and use the following line
  248.   'Data1.Caption = "Record: " & (Data1.Recordset.RecordCount * (Data1.Recordset.PercentPosition * 0.01)) + 1
  249. End Sub
  250. Private Sub Data1_Validate(Action As Integer, Save As Integer)
  251.   'This is where you put validation code
  252.   'This event gets called when the following actions occur
  253.   Select Case Action
  254.     Case vbDataActionMoveFirst
  255.     Case vbDataActionMovePrevious
  256.     Case vbDataActionMoveNext
  257.     Case vbDataActionMoveLast
  258.     Case vbDataActionAddNew
  259.     Case vbDataActionUpdate
  260.     Case vbDataActionDelete
  261.     Case vbDataActionFind
  262.     Case vbDataActionBookmark
  263.     Case vbDataActionClose
  264.   End Select
  265.   Screen.MousePointer = vbHourglass
  266. End Sub
  267.