home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD1811.psc / FrmAddressBook.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-11-14  |  18.4 KB  |  540 lines

  1. VERSION 5.00
  2. Begin VB.Form FrmAddressBook 
  3.    BackColor       =   &H00800000&
  4.    Caption         =   "Address Book"
  5.    ClientHeight    =   6510
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   7335
  9.    Icon            =   "FrmAddressBook.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    ScaleHeight     =   6510
  13.    ScaleWidth      =   7335
  14.    StartUpPosition =   2  'CenterScreen
  15.    Begin VB.Frame FramePersonalInformation 
  16.       BackColor       =   &H00800000&
  17.       Caption         =   "Personal Information:"
  18.       BeginProperty Font 
  19.          Name            =   "MS Sans Serif"
  20.          Size            =   9.75
  21.          Charset         =   0
  22.          Weight          =   700
  23.          Underline       =   0   'False
  24.          Italic          =   0   'False
  25.          Strikethrough   =   0   'False
  26.       EndProperty
  27.       ForeColor       =   &H000080FF&
  28.       Height          =   3135
  29.       Left            =   120
  30.       TabIndex        =   16
  31.       Top             =   120
  32.       Width           =   7095
  33.       Begin VB.TextBox txtName 
  34.          BeginProperty Font 
  35.             Name            =   "MS Sans Serif"
  36.             Size            =   9.75
  37.             Charset         =   0
  38.             Weight          =   700
  39.             Underline       =   0   'False
  40.             Italic          =   0   'False
  41.             Strikethrough   =   0   'False
  42.          EndProperty
  43.          ForeColor       =   &H000080FF&
  44.          Height          =   360
  45.          Left            =   1800
  46.          TabIndex        =   1
  47.          Top             =   240
  48.          Width           =   5175
  49.       End
  50.       Begin VB.TextBox txtAddress 
  51.          BeginProperty Font 
  52.             Name            =   "MS Sans Serif"
  53.             Size            =   9.75
  54.             Charset         =   0
  55.             Weight          =   700
  56.             Underline       =   0   'False
  57.             Italic          =   0   'False
  58.             Strikethrough   =   0   'False
  59.          EndProperty
  60.          ForeColor       =   &H000080FF&
  61.          Height          =   360
  62.          Left            =   1800
  63.          TabIndex        =   2
  64.          Top             =   720
  65.          Width           =   5175
  66.       End
  67.       Begin VB.TextBox txtCompany 
  68.          BeginProperty Font 
  69.             Name            =   "MS Sans Serif"
  70.             Size            =   9.75
  71.             Charset         =   0
  72.             Weight          =   700
  73.             Underline       =   0   'False
  74.             Italic          =   0   'False
  75.             Strikethrough   =   0   'False
  76.          EndProperty
  77.          ForeColor       =   &H000080FF&
  78.          Height          =   360
  79.          Left            =   1800
  80.          TabIndex        =   3
  81.          Text            =   "----------"
  82.          Top             =   1200
  83.          Width           =   5175
  84.       End
  85.       Begin VB.TextBox txtTelephone01 
  86.          BeginProperty Font 
  87.             Name            =   "MS Sans Serif"
  88.             Size            =   9.75
  89.             Charset         =   0
  90.             Weight          =   700
  91.             Underline       =   0   'False
  92.             Italic          =   0   'False
  93.             Strikethrough   =   0   'False
  94.          EndProperty
  95.          ForeColor       =   &H000080FF&
  96.          Height          =   360
  97.          Left            =   1800
  98.          TabIndex        =   4
  99.          Top             =   1680
  100.          Width           =   975
  101.       End
  102.       Begin VB.TextBox txtTelephone02 
  103.          BeginProperty Font 
  104.             Name            =   "MS Sans Serif"
  105.             Size            =   9.75
  106.             Charset         =   0
  107.             Weight          =   700
  108.             Underline       =   0   'False
  109.             Italic          =   0   'False
  110.             Strikethrough   =   0   'False
  111.          EndProperty
  112.          ForeColor       =   &H000080FF&
  113.          Height          =   360
  114.          Left            =   6000
  115.          TabIndex        =   5
  116.          Text            =   "0000000"
  117.          Top             =   1680
  118.          Width           =   975
  119.       End
  120.       Begin VB.TextBox txtCelular 
  121.          BeginProperty Font 
  122.             Name            =   "MS Sans Serif"
  123.             Size            =   9.75
  124.             Charset         =   0
  125.             Weight          =   700
  126.             Underline       =   0   'False
  127.             Italic          =   0   'False
  128.             Strikethrough   =   0   'False
  129.          EndProperty
  130.          ForeColor       =   &H000080FF&
  131.          Height          =   360
  132.          Left            =   1800
  133.          TabIndex        =   6
  134.          Top             =   2160
  135.          Width           =   975
  136.       End
  137.       Begin VB.TextBox txtFax 
  138.          BeginProperty Font 
  139.             Name            =   "MS Sans Serif"
  140.             Size            =   9.75
  141.             Charset         =   0
  142.             Weight          =   700
  143.             Underline       =   0   'False
  144.             Italic          =   0   'False
  145.             Strikethrough   =   0   'False
  146.          EndProperty
  147.          ForeColor       =   &H000080FF&
  148.          Height          =   360
  149.          Left            =   6000
  150.          TabIndex        =   7
  151.          Text            =   "0000000"
  152.          Top             =   2160
  153.          Width           =   975
  154.       End
  155.       Begin VB.TextBox txtEmail 
  156.          BeginProperty Font 
  157.             Name            =   "MS Sans Serif"
  158.             Size            =   9.75
  159.             Charset         =   0
  160.             Weight          =   700
  161.             Underline       =   0   'False
  162.             Italic          =   0   'False
  163.             Strikethrough   =   0   'False
  164.          EndProperty
  165.          ForeColor       =   &H000080FF&
  166.          Height          =   360
  167.          Left            =   1800
  168.          TabIndex        =   8
  169.          Top             =   2640
  170.          Width           =   5175
  171.       End
  172.       Begin VB.Label lbName 
  173.          AutoSize        =   -1  'True
  174.          BackColor       =   &H00800000&
  175.          Caption         =   "Name:"
  176.          BeginProperty Font 
  177.             Name            =   "MS Sans Serif"
  178.             Size            =   9.75
  179.             Charset         =   0
  180.             Weight          =   700
  181.             Underline       =   0   'False
  182.             Italic          =   0   'False
  183.             Strikethrough   =   0   'False
  184.          EndProperty
  185.          ForeColor       =   &H000080FF&
  186.          Height          =   240
  187.          Left            =   120
  188.          TabIndex        =   24
  189.          Top             =   240
  190.          Width           =   690
  191.       End
  192.       Begin VB.Label lbAddress 
  193.          AutoSize        =   -1  'True
  194.          BackColor       =   &H00800000&
  195.          Caption         =   "Address:"
  196.          BeginProperty Font 
  197.             Name            =   "MS Sans Serif"
  198.             Size            =   9.75
  199.             Charset         =   0
  200.             Weight          =   700
  201.             Underline       =   0   'False
  202.             Italic          =   0   'False
  203.             Strikethrough   =   0   'False
  204.          EndProperty
  205.          ForeColor       =   &H000080FF&
  206.          Height          =   240
  207.          Left            =   120
  208.          TabIndex        =   23
  209.          Top             =   720
  210.          Width           =   945
  211.       End
  212.       Begin VB.Label lbCompany 
  213.          AutoSize        =   -1  'True
  214.          BackColor       =   &H00800000&
  215.          Caption         =   "Company:"
  216.          BeginProperty Font 
  217.             Name            =   "MS Sans Serif"
  218.             Size            =   9.75
  219.             Charset         =   0
  220.             Weight          =   700
  221.             Underline       =   0   'False
  222.             Italic          =   0   'False
  223.             Strikethrough   =   0   'False
  224.          EndProperty
  225.          ForeColor       =   &H000080FF&
  226.          Height          =   240
  227.          Left            =   120
  228.          TabIndex        =   22
  229.          Top             =   1200
  230.          Width           =   1050
  231.       End
  232.       Begin VB.Label lbTelephone01 
  233.          AutoSize        =   -1  'True
  234.          BackColor       =   &H00800000&
  235.          Caption         =   "Telephone 01:"
  236.          BeginProperty Font 
  237.             Name            =   "MS Sans Serif"
  238.             Size            =   9.75
  239.             Charset         =   0
  240.             Weight          =   700
  241.             Underline       =   0   'False
  242.             Italic          =   0   'False
  243.             Strikethrough   =   0   'False
  244.          EndProperty
  245.          ForeColor       =   &H000080FF&
  246.          Height          =   240
  247.          Left            =   120
  248.          TabIndex        =   21
  249.          Top             =   1680
  250.          Width           =   1500
  251.       End
  252.       Begin VB.Label lbTelephone02 
  253.          AutoSize        =   -1  'True
  254.          BackColor       =   &H00800000&
  255.          Caption         =   "Telephone 02:"
  256.          BeginProperty Font 
  257.             Name            =   "MS Sans Serif"
  258.             Size            =   9.75
  259.             Charset         =   0
  260.             Weight          =   700
  261.             Underline       =   0   'False
  262.             Italic          =   0   'False
  263.             Strikethrough   =   0   'False
  264.          EndProperty
  265.          ForeColor       =   &H000080FF&
  266.          Height          =   240
  267.          Left            =   4320
  268.          TabIndex        =   20
  269.          Top             =   1680
  270.          Width           =   1500
  271.       End
  272.       Begin VB.Label lbCelular 
  273.          AutoSize        =   -1  'True
  274.          BackColor       =   &H00800000&
  275.          Caption         =   "Celular Num:"
  276.          BeginProperty Font 
  277.             Name            =   "MS Sans Serif"
  278.             Size            =   9.75
  279.             Charset         =   0
  280.             Weight          =   700
  281.             Underline       =   0   'False
  282.             Italic          =   0   'False
  283.             Strikethrough   =   0   'False
  284.          EndProperty
  285.          ForeColor       =   &H000080FF&
  286.          Height          =   240
  287.          Left            =   120
  288.          TabIndex        =   19
  289.          Top             =   2160
  290.          Width           =   1335
  291.       End
  292.       Begin VB.Label lbFax 
  293.          AutoSize        =   -1  'True
  294.          BackColor       =   &H00800000&
  295.          Caption         =   "Fax Number:"
  296.          BeginProperty Font 
  297.             Name            =   "MS Sans Serif"
  298.             Size            =   9.75
  299.             Charset         =   0
  300.             Weight          =   700
  301.             Underline       =   0   'False
  302.             Italic          =   0   'False
  303.             Strikethrough   =   0   'False
  304.          EndProperty
  305.          ForeColor       =   &H000080FF&
  306.          Height          =   240
  307.          Left            =   4320
  308.          TabIndex        =   18
  309.          Top             =   2160
  310.          Width           =   1320
  311.       End
  312.       Begin VB.Label lbEmail 
  313.          AutoSize        =   -1  'True
  314.          BackColor       =   &H00800000&
  315.          Caption         =   "E-Mail:"
  316.          BeginProperty Font 
  317.             Name            =   "MS Sans Serif"
  318.             Size            =   9.75
  319.             Charset         =   0
  320.             Weight          =   700
  321.             Underline       =   0   'False
  322.             Italic          =   0   'False
  323.             Strikethrough   =   0   'False
  324.          EndProperty
  325.          ForeColor       =   &H000080FF&
  326.          Height          =   240
  327.          Left            =   120
  328.          TabIndex        =   17
  329.          Top             =   2640
  330.          Width           =   735
  331.       End
  332.    End
  333.    Begin VB.Frame FrameContacts 
  334.       BackColor       =   &H00800000&
  335.       Caption         =   "Contacts:"
  336.       BeginProperty Font 
  337.          Name            =   "MS Sans Serif"
  338.          Size            =   9.75
  339.          Charset         =   0
  340.          Weight          =   700
  341.          Underline       =   0   'False
  342.          Italic          =   0   'False
  343.          Strikethrough   =   0   'False
  344.       EndProperty
  345.       ForeColor       =   &H000080FF&
  346.       Height          =   2295
  347.       Left            =   120
  348.       TabIndex        =   15
  349.       Top             =   3360
  350.       Width           =   7095
  351.       Begin VB.ListBox LstContacts 
  352.          BeginProperty Font 
  353.             Name            =   "MS Sans Serif"
  354.             Size            =   9.75
  355.             Charset         =   0
  356.             Weight          =   700
  357.             Underline       =   0   'False
  358.             Italic          =   0   'False
  359.             Strikethrough   =   0   'False
  360.          EndProperty
  361.          ForeColor       =   &H000080FF&
  362.          Height          =   1740
  363.          Left            =   120
  364.          Sorted          =   -1  'True
  365.          TabIndex        =   12
  366.          Top             =   360
  367.          Width           =   6855
  368.       End
  369.    End
  370.    Begin VB.Frame FrameButtons 
  371.       BackColor       =   &H00800000&
  372.       BeginProperty Font 
  373.          Name            =   "MS Sans Serif"
  374.          Size            =   9.75
  375.          Charset         =   0
  376.          Weight          =   700
  377.          Underline       =   0   'False
  378.          Italic          =   0   'False
  379.          Strikethrough   =   0   'False
  380.       EndProperty
  381.       ForeColor       =   &H000080FF&
  382.       Height          =   615
  383.       Left            =   120
  384.       TabIndex        =   0
  385.       Top             =   5760
  386.       Width           =   7095
  387.       Begin VB.CommandButton cmdSave 
  388.          Caption         =   "&Save"
  389.          Height          =   255
  390.          Left            =   120
  391.          TabIndex        =   9
  392.          Top             =   240
  393.          Width           =   975
  394.       End
  395.       Begin VB.CommandButton cmdNew 
  396.          Caption         =   "&New"
  397.          Height          =   255
  398.          Left            =   1560
  399.          TabIndex        =   10
  400.          Top             =   240
  401.          Width           =   975
  402.       End
  403.       Begin VB.CommandButton cmdDelete 
  404.          Caption         =   "&Delete"
  405.          Height          =   255
  406.          Left            =   3000
  407.          TabIndex        =   13
  408.          Top             =   240
  409.          Width           =   975
  410.       End
  411.       Begin VB.CommandButton cmdModify 
  412.          Caption         =   "&Modify"
  413.          Height          =   255
  414.          Left            =   4560
  415.          TabIndex        =   14
  416.          Top             =   240
  417.          Width           =   975
  418.       End
  419.       Begin VB.CommandButton cmdExit 
  420.          Caption         =   "&Exit"
  421.          Height          =   255
  422.          Left            =   6000
  423.          TabIndex        =   11
  424.          Top             =   240
  425.          Width           =   975
  426.       End
  427.    End
  428. Attribute VB_Name = "FrmAddressBook"
  429. Attribute VB_GlobalNameSpace = False
  430. Attribute VB_Creatable = False
  431. Attribute VB_PredeclaredId = True
  432. Attribute VB_Exposed = False
  433. Dim mydata As Database
  434. Dim myrecord As Recordset
  435. Dim SQL As String
  436. Private Sub cmdDelete_Click()
  437.     Set mydata = OpenDatabase(App.Path + "\" + "DBEnglishEspa
  438. ol.mdb")
  439.     SQL = "SELECT * FROM TblContacts"
  440.     Set myrecord = mydata.OpenRecordset(SQL)
  441.         Do Until myrecord.EOF
  442.             If LstContacts.Text = myrecord!CmpNames Then
  443.                 myrecord.Delete
  444.                 LstContacts.RemoveItem (LstContacts.ListIndex)
  445.             End If
  446.             myrecord.MoveNext
  447.         Loop
  448.     Call cmdNew_Click
  449. End Sub
  450. Private Sub cmdSave_Click()
  451.     Set mydata = OpenDatabase(App.Path + "\" + "DBEnglishEspa
  452. ol.mdb")
  453.     Set myrecord = mydata.OpenRecordset("TblContacts")
  454.     With myrecord
  455.         .AddNew
  456.         !CmpNames = Trim(txtName.Text)
  457.         !CmpAddress = Trim(txtAddress.Text)
  458.         !CmpCompany = Trim(txtCompany.Text)
  459.         !CmpTelephone01 = Trim(txtTelephone01.Text)
  460.         !CmpTelephone02 = Trim(txtTelephone02.Text)
  461.         !CmpCelular = Trim(txtCelular.Text)
  462.         !CmpFax = Trim(txtFax.Text)
  463.         !CmpEmail = Trim(txtEmail.Text)
  464.         .Update
  465.     End With
  466.     mydata.Close
  467.     LstContacts.AddItem txtName.Text
  468.     Call cmdNew_Click
  469. End Sub
  470. Private Sub cmdModify_Click()
  471.     Set mydata = OpenDatabase(App.Path + "\" + "DBEnglishEspa
  472. ol.mdb")
  473.     Set myrecord = mydata.OpenRecordset("TblContacts")
  474.         Do Until myrecord.EOF
  475.             If LstContacts.Text = myrecord!CmpNames Then
  476.                 LstContacts.RemoveItem (LstContacts.ListIndex)
  477.                 LstContacts.AddItem txtName.Text
  478.                 With myrecord
  479.                     .Edit
  480.                     !CmpNames = Trim(txtName.Text)
  481.                     !CmpAddress = Trim(txtAddress.Text)
  482.                     !CmpCompany = Trim(txtCompany.Text)
  483.                     !CmpTelephone01 = Trim(txtTelephone01.Text)
  484.                     !CmpTelephone02 = Trim(txtTelephone02.Text)
  485.                     !CmpCelular = Trim(txtCelular.Text)
  486.                     !CmpFax = Trim(txtFax.Text)
  487.                     !CmpEmail = Trim(txtEmail.Text)
  488.                     .Update
  489.                 End With
  490.             End If
  491.             myrecord.MoveNext
  492.         Loop
  493. End Sub
  494. Private Sub cmdNew_Click()
  495.     txtName.Text = ""
  496.     txtAddress.Text = ""
  497.     txtCompany.Text = ""
  498.     txtTelephone01.Text = ""
  499.     txtTelephone02.Text = ""
  500.     txtCelular.Text = ""
  501.     txtFax.Text = ""
  502.     txtEmail.Text = ""
  503.     txtName.SetFocus
  504. End Sub
  505. Private Sub cmdExit_Click()
  506.     Unload Me
  507.     End
  508. End Sub
  509. Private Sub Form_Load()
  510.     Set mydata = OpenDatabase(App.Path + "\" + "DBEnglishEspa
  511. ol.mdb")
  512.     Set myrecord = mydata.OpenRecordset("TblContacts")
  513.     myrecord.MoveFirst
  514.     Do Until myrecord.EOF
  515.         LstContacts.AddItem myrecord.Fields("CmpNames")
  516.         myrecord.MoveNext
  517.     Loop
  518.     mydata.Close
  519. End Sub
  520. Private Sub LstContacts_Click()
  521.     On Error Resume Next
  522.         Set mydata = OpenDatabase(App.Path + "\" + "DBEnglishEspa
  523. ol.mdb")
  524.         Set myrecord = mydata.OpenRecordset("TblContacts")
  525.         myrecord.MoveFirst
  526.         Do Until myrecord.EOF
  527.             If LstContacts.Text = myrecord!CmpNames Then
  528.                 txtName.Text = myrecord!CmpNames
  529.                 txtAddress.Text = myrecord!CmpAddress
  530.                 txtCompany.Text = myrecord!CmpCompany
  531.                 txtTelephone01.Text = myrecord!CmpTelephone01
  532.                 txtTelephone02.Text = myrecord!CmpTelephone02
  533.                 txtCelular.Text = myrecord!CmpCelular
  534.                 txtFax.Text = myrecord!CmpFax
  535.                 txtEmail.Text = myrecord!CmpEmail
  536.             End If
  537.             myrecord.MoveNext
  538.         Loop
  539. End Sub
  540.