home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / tinydb / tinytst.fr_ / tinytst.fr (.txt)
Encoding:
Visual Basic Form  |  1997-12-19  |  20.4 KB  |  694 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Sample Database with TinyDB for Visual Basic 5"
  4.    ClientHeight    =   4140
  5.    ClientLeft      =   3135
  6.    ClientTop       =   2460
  7.    ClientWidth     =   7890
  8.    Icon            =   "TINYTST.frx":0000
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    PaletteMode     =   1  'UseZOrder
  12.    ScaleHeight     =   4140
  13.    ScaleWidth      =   7890
  14.    Begin VB.CommandButton Command17 
  15.       Caption         =   "About"
  16.       Height          =   495
  17.       Left            =   3360
  18.       TabIndex        =   37
  19.       Top             =   2280
  20.       Width           =   975
  21.    End
  22.    Begin VB.Timer Timer1 
  23.       Interval        =   1
  24.       Left            =   3000
  25.       Top             =   0
  26.    End
  27.    Begin VB.CommandButton Command16 
  28.       Caption         =   "Show DB Struc"
  29.       Height          =   375
  30.       Left            =   120
  31.       TabIndex        =   36
  32.       Top             =   3240
  33.       Width           =   1575
  34.    End
  35.    Begin VB.CommandButton Command15 
  36.       Caption         =   "Read, No Display"
  37.       Height          =   495
  38.       Left            =   3360
  39.       TabIndex        =   35
  40.       Top             =   1800
  41.       Width           =   975
  42.    End
  43.    Begin VB.CheckBox Check3 
  44.       Caption         =   "Bof"
  45.       Height          =   255
  46.       Left            =   1800
  47.       TabIndex        =   32
  48.       Top             =   2880
  49.       Width           =   615
  50.    End
  51.    Begin VB.CheckBox Check2 
  52.       Caption         =   "Eof"
  53.       Height          =   255
  54.       Left            =   1080
  55.       TabIndex        =   31
  56.       Top             =   2880
  57.       Width           =   735
  58.    End
  59.    Begin VB.CheckBox Check1 
  60.       Caption         =   "Deleted"
  61.       Height          =   255
  62.       Left            =   120
  63.       TabIndex        =   30
  64.       Top             =   2880
  65.       Width           =   1335
  66.    End
  67.    Begin VB.CommandButton Command14 
  68.       Caption         =   "Exit"
  69.       Height          =   375
  70.       Left            =   6600
  71.       TabIndex        =   29
  72.       Top             =   3720
  73.       Width           =   1215
  74.    End
  75.    Begin VB.CommandButton Command13 
  76.       Caption         =   "FindPrev"
  77.       Height          =   375
  78.       Left            =   1800
  79.       TabIndex        =   28
  80.       Top             =   3240
  81.       Width           =   975
  82.    End
  83.    Begin VB.CommandButton Command12 
  84.       Caption         =   "FindNext"
  85.       Height          =   375
  86.       Left            =   3960
  87.       TabIndex        =   27
  88.       Top             =   3240
  89.       Width           =   975
  90.    End
  91.    Begin VB.CommandButton Command11 
  92.       Caption         =   "Random Add"
  93.       Height          =   495
  94.       Left            =   3360
  95.       TabIndex        =   25
  96.       Top             =   840
  97.       Width           =   975
  98.    End
  99.    Begin VB.CommandButton Command10 
  100.       Caption         =   "Find"
  101.       Height          =   375
  102.       Left            =   2880
  103.       TabIndex        =   24
  104.       Top             =   3240
  105.       Width           =   975
  106.    End
  107.    Begin VB.TextBox Text1 
  108.       Height          =   2655
  109.       Left            =   4440
  110.       Locked          =   -1  'True
  111.       MultiLine       =   -1  'True
  112.       ScrollBars      =   3  'Both
  113.       TabIndex        =   21
  114.       Top             =   360
  115.       Width           =   3375
  116.    End
  117.    Begin VB.CommandButton Command7 
  118.       Appearance      =   0  'Flat
  119.       BackColor       =   &H80000005&
  120.       Caption         =   "<"
  121.       Height          =   375
  122.       Left            =   480
  123.       TabIndex        =   20
  124.       Top             =   3720
  125.       Width           =   375
  126.    End
  127.    Begin VB.CommandButton Command9 
  128.       Appearance      =   0  'Flat
  129.       BackColor       =   &H80000005&
  130.       Caption         =   ">>"
  131.       Height          =   375
  132.       Left            =   1320
  133.       TabIndex        =   19
  134.       Top             =   3720
  135.       Width           =   375
  136.    End
  137.    Begin VB.TextBox Text2 
  138.       Height          =   285
  139.       Index           =   5
  140.       Left            =   960
  141.       TabIndex        =   12
  142.       Top             =   2160
  143.       Width           =   1095
  144.    End
  145.    Begin VB.TextBox Text2 
  146.       Height          =   285
  147.       Index           =   4
  148.       Left            =   960
  149.       TabIndex        =   11
  150.       Top             =   1800
  151.       Width           =   495
  152.    End
  153.    Begin VB.TextBox Text2 
  154.       Height          =   285
  155.       Index           =   3
  156.       Left            =   960
  157.       TabIndex        =   10
  158.       Top             =   1440
  159.       Width           =   1815
  160.    End
  161.    Begin VB.TextBox Text2 
  162.       Height          =   285
  163.       Index           =   2
  164.       Left            =   960
  165.       TabIndex        =   9
  166.       Top             =   1080
  167.       Width           =   2295
  168.    End
  169.    Begin VB.TextBox Text2 
  170.       Height          =   285
  171.       Index           =   1
  172.       Left            =   960
  173.       TabIndex        =   8
  174.       Top             =   720
  175.       Width           =   2295
  176.    End
  177.    Begin VB.TextBox Text2 
  178.       Height          =   285
  179.       Index           =   0
  180.       Left            =   960
  181.       TabIndex        =   7
  182.       Top             =   360
  183.       Width           =   2535
  184.    End
  185.    Begin VB.CommandButton Command8 
  186.       Caption         =   "Update"
  187.       Height          =   375
  188.       Left            =   2880
  189.       TabIndex        =   6
  190.       Top             =   3720
  191.       Width           =   975
  192.    End
  193.    Begin VB.CommandButton Command6 
  194.       Appearance      =   0  'Flat
  195.       BackColor       =   &H80000005&
  196.       Caption         =   ">"
  197.       Height          =   375
  198.       Left            =   960
  199.       TabIndex        =   5
  200.       Top             =   3720
  201.       Width           =   375
  202.    End
  203.    Begin VB.CommandButton Command5 
  204.       Caption         =   "Delete"
  205.       Height          =   375
  206.       Left            =   3960
  207.       TabIndex        =   4
  208.       Top             =   3720
  209.       Width           =   975
  210.    End
  211.    Begin VB.CommandButton Command4 
  212.       Appearance      =   0  'Flat
  213.       BackColor       =   &H80000005&
  214.       Caption         =   "<<"
  215.       Height          =   375
  216.       Left            =   120
  217.       TabIndex        =   3
  218.       Top             =   3720
  219.       Width           =   375
  220.    End
  221.    Begin VB.CommandButton Command3 
  222.       Caption         =   "Random Read"
  223.       Height          =   495
  224.       Left            =   3360
  225.       TabIndex        =   2
  226.       Top             =   1320
  227.       Width           =   975
  228.    End
  229.    Begin VB.CommandButton Command2 
  230.       Caption         =   "Add New"
  231.       Height          =   375
  232.       Left            =   1800
  233.       TabIndex        =   1
  234.       Top             =   3720
  235.       Width           =   975
  236.    End
  237.    Begin VB.CommandButton Command1 
  238.       Caption         =   "Open db"
  239.       Height          =   375
  240.       Left            =   5400
  241.       TabIndex        =   0
  242.       Top             =   3720
  243.       Width           =   1215
  244.    End
  245.    Begin VB.Label Label4 
  246.       Height          =   255
  247.       Left            =   5040
  248.       TabIndex        =   34
  249.       Top             =   3360
  250.       Width           =   2775
  251.    End
  252.    Begin VB.Label Label3 
  253.       Height          =   255
  254.       Left            =   5040
  255.       TabIndex        =   33
  256.       Top             =   3120
  257.       Width           =   2775
  258.    End
  259.    Begin VB.Label Label7 
  260.       Caption         =   "Label7"
  261.       Height          =   255
  262.       Left            =   120
  263.       TabIndex        =   26
  264.       Top             =   2520
  265.       Width           =   1455
  266.    End
  267.    Begin VB.Label Label6 
  268.       Caption         =   "Label6"
  269.       Height          =   255
  270.       Left            =   1680
  271.       TabIndex        =   23
  272.       Top             =   2520
  273.       Width           =   1335
  274.    End
  275.    Begin VB.Label Label2 
  276.       Caption         =   "Code Executed for last command:"
  277.       Height          =   255
  278.       Left            =   4440
  279.       TabIndex        =   22
  280.       Top             =   120
  281.       Width           =   2655
  282.    End
  283.    Begin VB.Label Label1 
  284.       Alignment       =   1  'Right Justify
  285.       Caption         =   "Name:"
  286.       Height          =   255
  287.       Index           =   11
  288.       Left            =   240
  289.       TabIndex        =   18
  290.       Top             =   360
  291.       Width           =   615
  292.    End
  293.    Begin VB.Label Label1 
  294.       Alignment       =   1  'Right Justify
  295.       Caption         =   "Address1:"
  296.       Height          =   255
  297.       Index           =   10
  298.       Left            =   120
  299.       TabIndex        =   17
  300.       Top             =   720
  301.       Width           =   735
  302.    End
  303.    Begin VB.Label Label1 
  304.       Alignment       =   1  'Right Justify
  305.       Caption         =   "Address2:"
  306.       Height          =   255
  307.       Index           =   9
  308.       Left            =   120
  309.       TabIndex        =   16
  310.       Top             =   1080
  311.       Width           =   735
  312.    End
  313.    Begin VB.Label Label1 
  314.       Alignment       =   1  'Right Justify
  315.       Caption         =   "City:"
  316.       Height          =   255
  317.       Index           =   8
  318.       Left            =   480
  319.       TabIndex        =   15
  320.       Top             =   1440
  321.       Width           =   375
  322.    End
  323.    Begin VB.Label Label1 
  324.       Alignment       =   1  'Right Justify
  325.       Caption         =   "State:"
  326.       Height          =   255
  327.       Index           =   7
  328.       Left            =   360
  329.       TabIndex        =   14
  330.       Top             =   1800
  331.       Width           =   495
  332.    End
  333.    Begin VB.Label Label1 
  334.       Alignment       =   1  'Right Justify
  335.       Caption         =   "Zip:"
  336.       Height          =   255
  337.       Index           =   6
  338.       Left            =   480
  339.       TabIndex        =   13
  340.       Top             =   2160
  341.       Width           =   375
  342.    End
  343. Attribute VB_Name = "Form1"
  344. Attribute VB_GlobalNameSpace = False
  345. Attribute VB_Creatable = False
  346. Attribute VB_PredeclaredId = True
  347. Attribute VB_Exposed = False
  348. Sub ShowFields()
  349. Text2(0) = MyDB.Field("Name")
  350. Text2(1) = MyDB.Field("Address1")
  351. Text2(2) = MyDB.Field("Address2")
  352. Text2(3) = MyDB.Field("City")
  353. Text2(4) = MyDB.Field("State")
  354. Text2(5) = MyDB.Field("Zip")
  355. End Sub
  356. Sub showit(fname)
  357. X = FreeFile
  358. Open App.Path + "\" + fname For Input As #X
  359. Text1.Text = ""
  360. Do Until EOF(X)
  361. Line Input #X, a$
  362. Text1.Text = Text1.Text + a$ + vbCrLf
  363. Close #X
  364. End Sub
  365. Sub updateflags()
  366. If MyDB.Deleted Then Check1.Value = 1 Else Check1.Value = 0
  367. If MyDB.EOF Then Check2.Value = 1 Else Check2.Value = 0
  368. If MyDB.BOF Then Check3.Value = 1 Else Check3.Value = 0
  369. Label6 = "Record:" + Str$(MyDB.Record)
  370. Label7 = "Records:" + Str$(MyDB.RecordCount)
  371. End Sub
  372. Private Sub Check1_Click()
  373. If MyDB.Deleted = True Then Check1.Value = 1 Else Check1.Value = 0
  374. End Sub
  375. Private Sub check2_Click()
  376. If MyDB.EOF = True Then Check2.Value = 1 Else Check2.Value = 0
  377. End Sub
  378. Private Sub check3_Click()
  379. If MyDB.BOF = True Then Check3.Value = 1 Else Check3.Value = 0
  380. End Sub
  381. Private Sub Command1_Click()
  382. Text1.Text = "MyDB.Startdb App.Path + " + Chr$(34) + "\sample.sdb" + Chr$(34)
  383. If MyDB.DBOpen = True Then MsgBox "The Database is already open": Exit Sub
  384. MyDB.StartDb App.Path + "\sample.sdb"
  385. End Sub
  386. Private Sub Command10_Click()
  387. If Not MyDB.DBOpen Then Exit Sub
  388. Form2.Show 1
  389. If cancelflag = True Then cancelflag = False: Exit Sub
  390. If MyDB.NoMatch Then MsgBox "No matching records": Exit Sub
  391. ShowFields
  392. updateflags
  393. End Sub
  394. Public Sub Command11_Click()
  395. If Not MyDB.DBOpen Then Exit Sub
  396. ' add 100 records
  397. Dim fname(0 To 10) As String
  398. Dim lname(0 To 10) As String
  399. Dim street(0 To 10) As String
  400. Dim city(0 To 10) As String
  401. Dim state(0 To 10) As String
  402. Dim zip(0 To 10) As String
  403. glass
  404. fname(0) = "Mark"
  405. fname(1) = "Amy"
  406. fname(2) = "Theresa"
  407. fname(3) = "Jim"
  408. fname(4) = "Jack"
  409. fname(5) = "Kathy"
  410. fname(6) = "Margie"
  411. fname(7) = "Tom"
  412. fname(8) = "Karen"
  413. fname(9) = "Jamie"
  414. fname(10) = "Denise"
  415. lname(0) = "Smith"
  416. lname(1) = "Jones"
  417. lname(2) = "Jackson"
  418. lname(3) = "Hoogen"
  419. lname(4) = "McDonald"
  420. lname(5) = "MacPherson"
  421. lname(6) = "McSherra"
  422. lname(7) = "Thorn"
  423. lname(8) = "Akins"
  424. lname(9) = "Dillon"
  425. lname(10) = "Robichard"
  426. street(0) = "Long St."
  427. street(1) = "Hittenger St."
  428. street(2) = "Boardman St."
  429. street(3) = "Mill St."
  430. street(4) = "Main St."
  431. street(5) = "Crescent St."
  432. street(6) = "Oak St."
  433. street(7) = "Maple St."
  434. street(8) = "Elm St."
  435. street(9) = "Rohouse St."
  436. street(10) = "Boston St."
  437. city(0) = "Westboro"
  438. city(1) = "Marlboro"
  439. city(2) = "Northboro"
  440. city(3) = "Southboro"
  441. city(4) = "Shrewsbury"
  442. city(5) = "Worcester"
  443. city(6) = "Holden"
  444. city(7) = "Hudson"
  445. city(8) = "Framingham"
  446. city(9) = "Belmont"
  447. city(10) = "Burlington"
  448. state(0) = "MA"
  449. state(1) = "NH"
  450. state(2) = "RI"
  451. state(3) = "NY"
  452. state(4) = "NJ"
  453. state(5) = "CT"
  454. state(6) = "VT"
  455. state(7) = "WV"
  456. state(8) = "WA"
  457. state(9) = "CA"
  458. state(10) = "DE"
  459. zip(0) = "00000"
  460. zip(1) = "00000"
  461. zip(2) = "00000"
  462. zip(3) = "00000"
  463. zip(4) = "00000"
  464. zip(5) = "00000"
  465. zip(6) = "00000"
  466. zip(7) = "00000"
  467. zip(8) = "00000"
  468. zip(9) = "00000"
  469. zip(10) = "00000"
  470. rr = Int(Rnd * 200)
  471. Form1.Label3 = "Action Started @: " + Time$
  472. For a = MyDB.RecordCount To MyDB.RecordCount + rr
  473. MyDB.AddNew
  474. Randomize
  475. X = Int(Rnd * 10): r = Int(Rnd * 10)
  476. MyDB.Field("name") = fname(X) + " " + lname(r)
  477. X = Int(Rnd * 10)
  478. MyDB.Field("address1") = Trim$(Str$(a)) + " " + street(X)
  479. X = Int(Rnd * 10)
  480. MyDB.Field("city") = city(X)
  481. X = Int(Rnd * 10)
  482. MyDB.Field("State") = state(X)
  483. X = Int(Rnd * 10)
  484. MyDB.Field("zip") = zip(X)
  485. 'ShowFields
  486. Next a
  487. Form1.Label4 = "Action  Ended @: " + Time$
  488. Text1 = "Added" + Str$(rr) + " records."
  489. MyDB.MoveLast
  490. ShowFields
  491. updateflags
  492. regular
  493. End Sub
  494. Private Sub Command12_Click()
  495. If Not MyDB.DBOpen Then Exit Sub
  496. glass
  497. Form1.Label3 = "Search Started @: " + Time$
  498. MyDB.FindNext
  499. Form1.Label4 = "Search Ended @: " + Time$
  500. If MyDB.NoMatch Then MsgBox "No matching records": regular: Exit Sub
  501. ShowFields
  502. updateflags
  503. Text1 = "MyDB.FindNext" + vbCrLf + "If MyDB.NoMatch Then MsgBox " + Chr$(34) + "No matching records" + Chr$(34) + ": Exit Sub" + vbCrLf + "ShowFields" + vbCrLf + "UpdateFlags"
  504. regular
  505. End Sub
  506. Private Sub Command13_Click()
  507. If Not MyDB.DBOpen Then Exit Sub
  508. glass
  509. Form1.Label3 = "Search Started @: " + Time$
  510. MyDB.FindPrevious
  511. Form1.Label4 = "Search Ended @: " + Time$
  512. If MyDB.NoMatch Then MsgBox "No matching records": regular: Exit Sub
  513. ShowFields
  514. updateflags
  515. regular
  516. Text1 = "MyDB.FindPrevious" + vbCrLf + "If MyDB.NoMatch Then MsgBox " + Chr$(34) + "No matching records" + Chr$(34) + ": Exit Sub" + vbCrLf + "ShowFields" + vbCrLf + "UpdateFlags"
  517. End Sub
  518. Private Sub Command14_Click()
  519. If Not MyDB.DBOpen Then Exit Sub
  520. Text1.Text = "MyDb.StopDb"
  521. If MyDB.DBOpen = False Then MsgBox "The Database is already stopped"
  522. MyDB.StopDb
  523. End Sub
  524. Private Sub Command15_Click()
  525. If Not MyDB.DBOpen Then Exit Sub
  526. glass
  527. X = Int(Rnd * 200)
  528. Text1 = "x = Int(Rnd * 100)" + vbCrLf + "For a = 1 To x" + vbCrLf + "If MyDB.Eof Then Exit For" + vbCrLf + "MyDB.MoveNext" + vbCrLf + "Next a" + vbCrLf + vbCrLf + "X =" + Str$(X)
  529. Form1.Label3 = "Action Started @: " + Time$
  530. For a = 1 To X
  531. If MyDB.EOF Then Exit For
  532. MyDB.MoveNext
  533. Next a
  534. ShowFields
  535. updateflags
  536. Form1.Label4 = "Action  Ended @: " + Time$
  537. regular
  538. End Sub
  539. Private Sub Command16_Click()
  540. If Not MyDB.DBOpen Then Exit Sub
  541. Text1 = ""
  542. For a = 1 To MyDB.FieldCount
  543. Text1.Text = Text1 + "Name: " + MyDB.FieldName(a) + vbCrLf
  544. Text1.Text = Text1 + "Type: " + Str$(MyDB.Fieldtype(a)) + vbCrLf
  545. Text1.Text = Text1 + "Length: " + Str$(MyDB.FieldLength(a)) + vbCrLf + vbCrLf
  546. Next a
  547. End Sub
  548. Private Sub Command17_Click()
  549. frmPlague.Show 1
  550. End Sub
  551. Private Sub Command2_Click()
  552. If Not MyDB.DBOpen Then Exit Sub
  553. MyDB.AddNew
  554. For a = 0 To 5
  555. Text2(a) = ""
  556. Next a
  557. Text1.Text = "For a = 0 to 5" + vbCrLf + "Text2 (a) =" + Chr$(34) + Chr$(34) + vbCrLf + "Next a" + vbCrLf + "MyDB.AddNew"
  558. End Sub
  559. Private Sub Command3_Click()
  560. If Not MyDB.DBOpen Then Exit Sub
  561. glass
  562. X = Int(Rnd * 200)
  563. Text1 = "x = Int(Rnd * 100)" + vbCrLf + "For a = 1 To x" + vbCrLf + "ShowFields" + vbCrLf + "DoEvents" + vbCrLf + "UpdateFlags" + vbCrLf + "If MyDB.Eof Then Exit For" + vbCrLf + "MyDB.MoveNext" + vbCrLf + "Next a" + vbCrLf + vbCrLf + "X =" + Str$(X)
  564. Form1.Label3 = "Action Started @: " + Time$
  565. For a = 1 To X
  566. ShowFields
  567. DoEvents
  568. updateflags
  569. If MyDB.EOF Then Exit For
  570. MyDB.MoveNext
  571. Next a
  572. Form1.Label4 = "Action  Ended @: " + Time$
  573. regular
  574. End Sub
  575. Private Sub Command4_Click()
  576. If Not MyDB.DBOpen Then Exit Sub
  577. MyDB.MoveFirst
  578. ShowFields
  579. updateflags
  580. Text1.Text = "MyDB.MoveFirst" + vbCrLf + "ShowFields" + vbCrLf + "UpdateFlags"
  581. End Sub
  582. Private Sub Command5_Click()
  583. If Not MyDB.DBOpen Then Exit Sub
  584. MyDB.Delete
  585. End Sub
  586. Private Sub Command6_Click()
  587. If Not MyDB.DBOpen Then Exit Sub
  588. Text1.Text = "If MyDB.Eof Then Exit Sub" + vbCrLf + "MyDB.MoveNext" + vbCrLf + "ShowFields" + vbCrLf + "UpdateFlags"
  589. If MyDB.EOF Then Exit Sub
  590. MyDB.MoveNext
  591. ShowFields
  592. updateflags
  593. End Sub
  594. Private Sub Command6_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  595. comm6down = True
  596. End Sub
  597. Private Sub Command6_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  598. comm6down = False
  599. End Sub
  600. Private Sub Command7_Click()
  601. If Not MyDB.DBOpen Then Exit Sub
  602. Text1.Text = "If MyDB.bof Then Exit Sub" + vbCrLf + "MyDB.MovePrevious" + vbCrLf + "ShowFields" + vbCrLf + "UpdateFlags"
  603. If MyDB.BOF Then Exit Sub
  604. MyDB.MovePrevious
  605. ShowFields
  606. updateflags
  607. End Sub
  608. Private Sub Command7_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  609. comm7down = True
  610. End Sub
  611. Private Sub Command7_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  612. comm7down = False
  613. End Sub
  614. Private Sub Command8_Click()
  615. If Not MyDB.DBOpen Then Exit Sub
  616. MyDB.Field("Name") = Text2(0)
  617. MyDB.Field("Address1") = Text2(1)
  618. MyDB.Field("Address2") = Text2(2)
  619. MyDB.Field("City") = Text2(3)
  620. MyDB.Field("State") = Text2(4)
  621. MyDB.Field("Zip") = Text2(5)
  622. updateflags
  623. Text1.Text = "MyDB.Field(" + Chr$(34) + "Name" + Chr$(34) + ") = Text2(0)"
  624. Text1 = Text1 + vbCrLf + "MyDB.Field(" + Chr$(34) + "Address1" + Chr$(34) + ") = Text2(1)"
  625. Text1 = Text1 + vbCrLf + "MyDB.Field(" + Chr$(34) + "Address2" + Chr$(34) + ") = Text2(2)"
  626. Text1 = Text1 + vbCrLf + "MyDB.Field(" + Chr$(34) + "City" + Chr$(34) + ") = Text2(3)"
  627. Text1 = Text1 + vbCrLf + "MyDB.Field(" + Chr$(34) + "State" + Chr$(34) + ") = Text2(4)"
  628. Text1 = Text1 + vbCrLf + "MyDB.Field(" + Chr$(34) + "Zip" + Chr$(34) + ") = Text2(5)"
  629. End Sub
  630. Private Sub Command9_Click()
  631. If Not MyDB.DBOpen Then Exit Sub
  632. Text1.Text = "If MyDB.Eof Then Exit Sub" + vbCrLf + "MyDB.MoveLast" + vbCrLf + "ShowFields" + vbCrLf + "UpdateFlags"
  633. If MyDB.EOF Then Exit Sub
  634. MyDB.MoveLast
  635. ShowFields
  636. updateflags
  637. End Sub
  638. Private Sub Form_Load()
  639. 'Form3.Show 1
  640. If Dir$(App.Path + "\sample.sdb") = "" Then
  641. MyDB.StartCreate
  642. MyDB.AddField "Name", 0, 35
  643. MyDB.AddField "Company", 0, 35
  644. MyDB.AddField "Address1", 0, 35
  645. MyDB.AddField "Address2", 0, 35
  646. MyDB.AddField "City", 0, 35
  647. MyDB.AddField "State", 0, 2
  648. MyDB.AddField "Zip", 0, 15
  649. result = MyDB.CreateDb(App.Path + "\sample.sdb")
  650. If result = False Then MsgBox "Could not create file."
  651. Form1.Show
  652. Form1.Refresh
  653. MyDB.StartDb App.Path + "\sample.sdb"
  654. Command11_Click
  655. MyDB.StopDb
  656. End If
  657. MyDB.StartDb App.Path + "\sample.sdb"
  658. If MyDB.DBOpen = False Then MsgBox "Could not open Database."
  659. MyDB.MoveFirst
  660. ShowFields
  661. updateflags
  662. End Sub
  663. Private Sub Form_Unload(Cancel As Integer)
  664. If MyDB.DBOpen Then MyDB.StopDb
  665. Set MyDB = Nothing
  666. End Sub
  667. Private Sub Timer1_Timer()
  668. Static myinterval7 As Integer
  669. Static myinterval6 As Integer
  670. If comm7down = True Then
  671. Text1.Text = "If MyDB.bof Then Exit Sub" + vbCrLf + "MyDB.MovePrevious" + vbCrLf + "ShowFields" + vbCrLf + "UpdateFlags"
  672. If MyDB.BOF Then Exit Sub
  673. MyDB.MovePrevious
  674. ShowFields
  675. updateflags
  676. myinterval7 = 1
  677. Timer1.Interval = myinterval7
  678. Exit Sub
  679. myinterval7 = 2000
  680. Timer1.Interval = myinterval7
  681. End If
  682. If comm6down = True Then
  683. Text1.Text = "If MyDB.Eof Then Exit Sub" + vbCrLf + "MyDB.MovePrevious" + vbCrLf + "ShowFields" + vbCrLf + "UpdateFlags"
  684. If MyDB.EOF Then Exit Sub
  685. MyDB.MoveNext
  686. ShowFields
  687. updateflags
  688. myinterval6 = 1
  689. Timer1.Interval = myinterval6
  690. myinterval6 = 2000
  691. Timer1.Interval = myinterval6
  692. End If
  693. End Sub
  694.