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

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