home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "Customer Data Entry"
- ClientHeight = 4560
- ClientLeft = 1200
- ClientTop = 1605
- ClientWidth = 6630
- Height = 5025
- Left = 1110
- LinkTopic = "Form1"
- ScaleHeight = 4560
- ScaleWidth = 6630
- Top = 1230
- Width = 6810
- Begin VB.PictureBox Picture2
- Height = 1215
- Left = 360
- ScaleHeight = 1185
- ScaleWidth = 5985
- TabIndex = 0
- Top = 2640
- Width = 6015
- Begin VB.CommandButton Command10
- Caption = "Delete Record"
- Height = 375
- Left = 4080
- TabIndex = 25
- Top = 720
- Width = 1575
- End
- Begin VB.CommandButton Command9
- Caption = "Seek Name"
- Height = 375
- Left = 4680
- TabIndex = 24
- Top = 120
- Width = 1095
- End
- Begin VB.CommandButton Command8
- Caption = "Edit Record"
- Height = 375
- Left = 2280
- TabIndex = 6
- Top = 720
- Width = 1455
- End
- Begin VB.CommandButton Command7
- Caption = "Add New Record"
- Height = 375
- Left = 240
- TabIndex = 5
- Top = 720
- Width = 1575
- End
- Begin VB.CommandButton Command6
- Caption = "Bottom"
- Height = 375
- Left = 3600
- TabIndex = 4
- Top = 120
- Width = 855
- End
- Begin VB.CommandButton Command5
- Caption = "Next"
- Height = 375
- Left = 2520
- TabIndex = 3
- Top = 120
- Width = 855
- End
- Begin VB.CommandButton Command4
- Caption = "Previous"
- Height = 375
- Left = 1320
- TabIndex = 2
- Top = 120
- Width = 975
- End
- Begin VB.CommandButton Command3
- Caption = "Top"
- Height = 375
- Left = 240
- TabIndex = 1
- Top = 120
- Width = 855
- End
- End
- Begin VB.TextBox Text1
- Height = 285
- Index = 6
- Left = 1680
- TabIndex = 23
- Text = "Text1"
- Top = 2040
- Width = 1095
- End
- Begin VB.TextBox Text1
- Height = 285
- Index = 5
- Left = 4560
- TabIndex = 22
- Text = "Text1"
- Top = 1440
- Width = 735
- End
- Begin VB.TextBox Text1
- Height = 285
- Index = 4
- Left = 2880
- TabIndex = 21
- Text = "Text1"
- Top = 1440
- Width = 375
- End
- Begin VB.TextBox Text1
- Height = 285
- Index = 3
- Left = 840
- TabIndex = 20
- Text = "Text1"
- Top = 1440
- Width = 1095
- End
- Begin VB.TextBox Text1
- Height = 285
- Index = 2
- Left = 1200
- TabIndex = 19
- Text = "Text1"
- Top = 960
- Width = 1455
- End
- Begin VB.TextBox Text1
- Height = 285
- Index = 1
- Left = 4320
- TabIndex = 18
- Text = "Text1"
- Top = 480
- Width = 1455
- End
- Begin VB.TextBox Text1
- Height = 285
- Index = 0
- Left = 1320
- TabIndex = 17
- Text = "Text1"
- Top = 480
- Width = 1455
- End
- Begin VB.PictureBox Picture3
- Height = 855
- Left = 600
- ScaleHeight = 825
- ScaleWidth = 5265
- TabIndex = 7
- Top = 2640
- Visible = 0 'False
- Width = 5295
- Begin VB.CommandButton Command2
- Caption = "Cancel Edit"
- Height = 375
- Left = 3240
- TabIndex = 9
- Top = 240
- Width = 1695
- End
- Begin VB.CommandButton Command1
- Caption = "Save Changes"
- Height = 375
- Left = 240
- TabIndex = 8
- Top = 240
- Width = 1815
- End
- End
- Begin VB.Label Label7
- Caption = "Phone Number:"
- Height = 255
- Left = 360
- TabIndex = 16
- Top = 2040
- Width = 1215
- End
- Begin VB.Label Label6
- Caption = "Zip Code:"
- Height = 255
- Left = 3720
- TabIndex = 15
- Top = 1440
- Width = 855
- End
- Begin VB.Label Label5
- Caption = "State:"
- Height = 255
- Left = 2280
- TabIndex = 14
- Top = 1440
- Width = 495
- End
- Begin VB.Label Label4
- Caption = "City:"
- Height = 255
- Left = 360
- TabIndex = 13
- Top = 1440
- Width = 495
- End
- Begin VB.Label Label3
- Caption = "Address:"
- Height = 255
- Left = 360
- TabIndex = 12
- Top = 960
- Width = 735
- End
- Begin VB.Label Label2
- Caption = "First Name:"
- Height = 255
- Left = 3240
- TabIndex = 11
- Top = 480
- Width = 975
- End
- Begin VB.Label Label1
- Caption = "Last Name:"
- Height = 255
- Left = 360
- TabIndex = 10
- Top = 480
- Width = 975
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Dim OldDb As DATABASE, RcSet As Recordset
- Dim Addfl As Integer, Addrc As String
- Sub Showfields()
- Text1(0).TEXT = IIf(IsNull(RcSet("Lastname")), " ", RcSet("Lastname"))
- Text1(1).TEXT = IIf(IsNull(RcSet("Firstname")), " ", RcSet("Firstname"))
- Text1(2).TEXT = IIf(IsNull(RcSet("Address")), " ", RcSet("Address"))
- Text1(3).TEXT = IIf(IsNull(RcSet("City")), " ", RcSet("City"))
- Text1(4).TEXT = IIf(IsNull(RcSet("State")), " ", RcSet("State"))
- Text1(5).TEXT = IIf(IsNull(RcSet("Zip")), " ", RcSet("Zip"))
- Text1(6).TEXT = IIf(IsNull(RcSet("Phone")), " ", RcSet("Phone"))
- End Sub
- Private Sub Command1_Click()
- Picture3.Visible = False
- Picture2.Visible = True
- For I = 0 To 6
- Text1(I).ForeColor = &HFF0000
- Next I
- RcSet("Lastname") = Left(Text1(0).TEXT, 30)
- RcSet("Firstname") = Left(Text1(1).TEXT, 30)
- RcSet("Address") = Left(Text1(2).TEXT, 40)
- RcSet("City") = Left(Text1(3).TEXT, 30)
- RcSet("State") = Left(Text1(4).TEXT, 2)
- RcSet("Zip") = Left(Text1(5).TEXT, 5)
- RcSet("Phone") = Left(Text1(6).TEXT, 13)
- RcSet.UPDATE
- End Sub
- Private Sub Command10_Click()
- If MsgBox("Are you sure you want to delete this record?", 4) = 6 Then
- RcSet.DELETE
- If Not RcSet.EOF Then
- RcSet.MoveNext
- Else
- RcSet.MovePrevious
- End If
- Call Showfields
- End If
- End Sub
- Private Sub Command2_Click()
- Picture3.Visible = False
- Picture2.Visible = True
- For I = 0 To 6
- Text1(I).ForeColor = &HFF0000
- Next I
- If Addfl Then
- RcSet.Bookmark = Addrc
- End If
- Call Showfields
- End Sub
- Private Sub Command3_Click()
- RcSet.MoveFirst
- Command4.Enabled = False
- Command5.Enabled = True
- Call Showfields
- End Sub
- Private Sub Command4_Click()
- RcSet.MovePrevious
- If RcSet.BOF Then
- RcSet.MoveFirst
- Command4.Enabled = False
- End If
- Command5.Enabled = True
- Call Showfields
- End Sub
- Private Sub Command5_Click()
- RcSet.MoveNext
- If RcSet.EOF Then
- RcSet.MoveLast
- Command5.Enabled = False
- End If
- Command4.Enabled = True
- Call Showfields
- End Sub
- Private Sub Command6_Click()
- RcSet.MoveLast
- Command4.Enabled = True
- Command5.Enabled = False
- Call Showfields
- End Sub
- Private Sub Command7_Click()
- Picture2.Visible = False
- Picture3.Visible = True
- Addfl = True
- Addrc = RcSet.Bookmark
- RcSet.AddNew
- Text1(0).TEXT = " "
- Text1(1).TEXT = " "
- Text1(2).TEXT = " "
- Text1(3).TEXT = " "
- Text1(4).TEXT = " "
- Text1(5).TEXT = " "
- Text1(6).TEXT = " "
- For I = 0 To 6
- Text1(I).ForeColor = &HFF&
- Next I
- End Sub
- Private Sub Command8_Click()
- Picture2.Visible = False
- Picture3.Visible = True
- For I = 0 To 6
- Text1(I).ForeColor = &HFF&
- Next I
- RcSet.Edit
- End Sub
- Private Sub Command9_Click()
- Dim addrc2 As String
- addrc2 = RcSet.Bookmark
- Form2.Show 1
- If Seekac = 1 Then
- RcSet.Seek ">=", Seeknm
- If RcSet.NoMatch Then
- RcSet.Bookmark = addrc2
- End If
- End If
- Call Showfields
- End Sub
- Private Sub Form_Load()
- dbname = App.Path & "\CHAPTER4.MDB"
- Set OldDb = OpenDatabase(dbname)
- Set RcSet = OldDb.OpenRecordset("Customers", dbOpenTable)
- RcSet.Index = "Name"
- RcSet.MoveFirst
- Call Showfields
- Command4.Enabled = False
- For I = 0 To 6
- ' Text1(I).Enabled = False
- Text1(I).ForeColor = &HFF0000
- Next I
- End Sub
-