home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap27 / frm427.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-28  |  8.8 KB  |  306 lines

  1. VERSION 4.00
  2. Begin VB.Form form3 
  3.    Caption         =   "Bound Form Dbase"
  4.    ClientHeight    =   4785
  5.    ClientLeft      =   1980
  6.    ClientTop       =   1860
  7.    ClientWidth     =   6690
  8.    Height          =   5190
  9.    Left            =   1920
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4785
  12.    ScaleWidth      =   6690
  13.    Top             =   1515
  14.    Width           =   6810
  15.    Begin VB.CommandButton cmdrefresh 
  16.       Caption         =   "&Refresh"
  17.       Height          =   295
  18.       Left            =   2280
  19.       TabIndex        =   23
  20.       Top             =   4080
  21.       Width           =   1215
  22.    End
  23.    Begin VB.CommandButton cmdupdate 
  24.       Caption         =   "&Update "
  25.       Height          =   295
  26.       Left            =   780
  27.       TabIndex        =   22
  28.       Top             =   4080
  29.       Width           =   1215
  30.    End
  31.    Begin VB.CommandButton cmdadd 
  32.       Caption         =   "&Add"
  33.       Height          =   295
  34.       Left            =   3720
  35.       TabIndex        =   21
  36.       Top             =   4080
  37.       Width           =   1215
  38.    End
  39.    Begin VB.ComboBox comfield 
  40.       Height          =   315
  41.       Left            =   1560
  42.       Style           =   2  'Dropdown List
  43.       TabIndex        =   19
  44.       Top             =   3120
  45.       Width           =   1875
  46.    End
  47.    Begin VB.TextBox txtcomments 
  48.       DataField       =   "Comments"
  49.       DataSource      =   "Data1"
  50.       Height          =   285
  51.       Left            =   1560
  52.       MultiLine       =   -1  'True
  53.       TabIndex        =   17
  54.       Top             =   2280
  55.       Width           =   4635
  56.    End
  57.    Begin VB.TextBox txtnotes 
  58.       DataField       =   "Notes"
  59.       DataSource      =   "Data1"
  60.       Height          =   285
  61.       Left            =   1560
  62.       MultiLine       =   -1  'True
  63.       TabIndex        =   15
  64.       Top             =   2700
  65.       Width           =   4635
  66.    End
  67.    Begin VB.TextBox txtdescription 
  68.       DataField       =   "DESCRIPTIO"
  69.       DataSource      =   "Data1"
  70.       Height          =   285
  71.       Left            =   1560
  72.       MultiLine       =   -1  'True
  73.       TabIndex        =   13
  74.       Top             =   1860
  75.       Width           =   4635
  76.    End
  77.    Begin VB.TextBox txtpubid 
  78.       DataField       =   "PubID"
  79.       DataSource      =   "Data1"
  80.       Height          =   285
  81.       Left            =   1560
  82.       MultiLine       =   -1  'True
  83.       TabIndex        =   11
  84.       Top             =   180
  85.       Width           =   855
  86.    End
  87.    Begin VB.TextBox txtisbn 
  88.       DataField       =   "isbn"
  89.       DataSource      =   "Data1"
  90.       Height          =   285
  91.       Left            =   1560
  92.       MultiLine       =   -1  'True
  93.       TabIndex        =   9
  94.       Top             =   600
  95.       Width           =   1635
  96.    End
  97.    Begin VB.TextBox txtyear 
  98.       DataField       =   "YEAR_PUBLI"
  99.       DataSource      =   "Data1"
  100.       Height          =   315
  101.       Left            =   5040
  102.       MultiLine       =   -1  'True
  103.       TabIndex        =   7
  104.       Top             =   180
  105.       Width           =   855
  106.    End
  107.    Begin VB.CheckBox chkeof 
  108.       Caption         =   "EOF Reached"
  109.       Enabled         =   0   'False
  110.       Height          =   295
  111.       Left            =   2340
  112.       TabIndex        =   6
  113.       Top             =   3660
  114.       Width           =   1875
  115.    End
  116.    Begin VB.CheckBox chkbof 
  117.       Caption         =   "BOF Reached"
  118.       Enabled         =   0   'False
  119.       Height          =   295
  120.       Left            =   180
  121.       TabIndex        =   5
  122.       Top             =   3660
  123.       Width           =   1875
  124.    End
  125.    Begin VB.CommandButton cmdexit 
  126.       Caption         =   "E&xit"
  127.       Height          =   295
  128.       Left            =   5220
  129.       TabIndex        =   4
  130.       Top             =   4080
  131.       Width           =   1215
  132.    End
  133.    Begin VB.Data Data1 
  134.       Align           =   2  'Align Bottom
  135.       BOFAction       =   1  'BOF
  136.       Caption         =   "Data Control"
  137.       Connect         =   "dBASE III;"
  138.       DatabaseName    =   "\source\chp27"
  139.       EOFAction       =   2  'Add New
  140.       Exclusive       =   0   'False
  141.       Height          =   300
  142.       Left            =   0
  143.       Options         =   0
  144.       ReadOnly        =   0   'False
  145.       RecordsetType   =   1  'Dynaset
  146.       RecordSource    =   "title"
  147.       Top             =   4485
  148.       Width           =   6690
  149.    End
  150.    Begin VB.TextBox txtsubject 
  151.       DataField       =   "Subject"
  152.       DataSource      =   "Data1"
  153.       Height          =   285
  154.       Left            =   1560
  155.       MultiLine       =   -1  'True
  156.       TabIndex        =   3
  157.       Top             =   1440
  158.       Width           =   4635
  159.    End
  160.    Begin VB.TextBox txttitle 
  161.       DataField       =   "Title"
  162.       DataSource      =   "Data1"
  163.       Height          =   285
  164.       Left            =   1560
  165.       MultiLine       =   -1  'True
  166.       TabIndex        =   2
  167.       Top             =   1020
  168.       Width           =   4635
  169.    End
  170.    Begin VB.Label Label1 
  171.       Caption         =   "Order by"
  172.       Height          =   285
  173.       Index           =   7
  174.       Left            =   180
  175.       TabIndex        =   20
  176.       Top             =   3180
  177.       Width           =   1215
  178.    End
  179.    Begin VB.Label Label1 
  180.       Caption         =   "Comments"
  181.       Height          =   285
  182.       Index           =   6
  183.       Left            =   180
  184.       TabIndex        =   18
  185.       Top             =   2280
  186.       Width           =   1215
  187.    End
  188.    Begin VB.Label Label1 
  189.       Caption         =   "Notes"
  190.       Height          =   285
  191.       Index           =   5
  192.       Left            =   180
  193.       TabIndex        =   16
  194.       Top             =   2700
  195.       Width           =   1215
  196.    End
  197.    Begin VB.Label Label1 
  198.       Caption         =   "Description"
  199.       Height          =   285
  200.       Index           =   4
  201.       Left            =   180
  202.       TabIndex        =   14
  203.       Top             =   1860
  204.       Width           =   1215
  205.    End
  206.    Begin VB.Label Label1 
  207.       Caption         =   "Pub. ID"
  208.       Height          =   285
  209.       Index           =   3
  210.       Left            =   180
  211.       TabIndex        =   12
  212.       Top             =   180
  213.       Width           =   1215
  214.    End
  215.    Begin VB.Label Label1 
  216.       Caption         =   "ISBN"
  217.       Height          =   285
  218.       Index           =   2
  219.       Left            =   180
  220.       TabIndex        =   10
  221.       Top             =   600
  222.       Width           =   1215
  223.    End
  224.    Begin VB.Label Label1 
  225.       Caption         =   "Year Published"
  226.       Height          =   285
  227.       Index           =   1
  228.       Left            =   3660
  229.       TabIndex        =   8
  230.       Top             =   180
  231.       Width           =   1215
  232.    End
  233.    Begin VB.Label Label2 
  234.       Caption         =   "Subject"
  235.       Height          =   285
  236.       Left            =   180
  237.       TabIndex        =   1
  238.       Top             =   1440
  239.       Width           =   1215
  240.    End
  241.    Begin VB.Label Label1 
  242.       Caption         =   "Title"
  243.       Height          =   285
  244.       Index           =   0
  245.       Left            =   180
  246.       TabIndex        =   0
  247.       Top             =   1020
  248.       Width           =   1215
  249.    End
  250. Attribute VB_Name = "form3"
  251. Attribute VB_Creatable = False
  252. Attribute VB_Exposed = False
  253. Option Explicit
  254. Private Sub cmdadd_Click()
  255. Data1.Recordset.AddNew
  256. End Sub
  257. Private Sub cmdexit_Click()
  258. Unload Me
  259. Set form4 = Nothing
  260. End Sub
  261. Private Sub cmdrefresh_Click()
  262. Data1.Refresh
  263. End Sub
  264. Private Sub cmdupdate_Click()
  265. Data1.UpdateRecord
  266. End Sub
  267. Private Sub comfield_Click()
  268.     If Not comfield.TEXT = "Comments" Then
  269.         Data1.RecordSource = "select * From title order by [" & comfield.TEXT & "]"
  270.         Data1.Refresh
  271.     End If
  272. End Sub
  273. Private Sub Data1_Error(DataErr As Integer, Response As Integer)
  274.     If DataErr > 0 Then
  275.         MsgBox " The Following Error Occured " & DataErr & " " & Error$
  276.         DataErr = 0
  277.     End If
  278. End Sub
  279. Private Sub Data1_Reposition()
  280. If Data1.Recordset.BOF = True Then
  281.     chkbof.VALUE = vbChecked
  282.     chkbof.VALUE = vbUnchecked
  283. End If
  284. If Data1.Recordset.EOF = True Then
  285.     chkeof.VALUE = vbChecked
  286.     chkeof.VALUE = vbUnchecked
  287. End If
  288. End Sub
  289. Private Sub Data1_Validate(Action As Integer, Save As Integer)
  290. If Save = False Then
  291.     Exit Sub
  292. End If
  293. If MsgBox(" Save Record Changed ", vbYesNo, "", "", 0) = vbNo Then
  294.     Action = 0
  295.     Exit Sub
  296. End If
  297. End Sub
  298. Private Sub Form_Load()
  299.     Dim x As Integer
  300.     Data1.Align = 2
  301.     Data1.Refresh
  302.     For x = 0 To Data1.Recordset.Fields.Count - 1
  303.         comfield.AddItem Data1.Recordset.Fields(x).Name
  304.     Next x
  305. End Sub
  306.