home *** CD-ROM | disk | FTP | other *** search
/ Computer Buyer 1998 October / dpcb1098.iso / Business / Maxim / MAX5 / data.z / Persform.frm < prev    next >
Text File  |  1998-05-10  |  21KB  |  682 lines

  1. VERSION 5.00
  2. Begin VB.Form Persform 
  3.    Caption         =   "Maximizer Address Book (ODBC Version)"
  4.    ClientHeight    =   5220
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   8550
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   5220
  10.    ScaleWidth      =   8550
  11.    StartUpPosition =   1  'CenterOwner
  12.    Begin VB.TextBox EntryType 
  13.       Enabled         =   0   'False
  14.       Height          =   285
  15.       Left            =   5400
  16.       MaxLength       =   21
  17.       TabIndex        =   51
  18.       Top             =   3480
  19.       Width           =   2175
  20.    End
  21.    Begin VB.CommandButton Command6 
  22.       Caption         =   "&Previous"
  23.       Height          =   375
  24.       Left            =   120
  25.       TabIndex        =   49
  26.       Top             =   4560
  27.       Width           =   1095
  28.    End
  29.    Begin VB.CommandButton Command5 
  30.       Caption         =   "Ne&xt"
  31.       Height          =   375
  32.       Left            =   1440
  33.       TabIndex        =   48
  34.       Top             =   4560
  35.       Width           =   1095
  36.    End
  37.    Begin VB.CommandButton Command4 
  38.       Caption         =   "&Delete"
  39.       Default         =   -1  'True
  40.       Height          =   375
  41.       Left            =   6120
  42.       TabIndex        =   47
  43.       Top             =   4560
  44.       Width           =   1095
  45.    End
  46.    Begin VB.CommandButton Command3 
  47.       Caption         =   "&Update"
  48.       Height          =   375
  49.       Left            =   4920
  50.       TabIndex        =   46
  51.       Top             =   4560
  52.       Width           =   1095
  53.    End
  54.    Begin VB.TextBox ID 
  55.       Enabled         =   0   'False
  56.       Height          =   285
  57.       Left            =   5400
  58.       MaxLength       =   23
  59.       TabIndex        =   31
  60.       Top             =   1680
  61.       Width           =   2175
  62.    End
  63.    Begin VB.TextBox Phone4Ext 
  64.       Height          =   285
  65.       Left            =   7680
  66.       MaxLength       =   5
  67.       TabIndex        =   43
  68.       Top             =   3120
  69.       Width           =   735
  70.    End
  71.    Begin VB.TextBox Phone4 
  72.       Height          =   285
  73.       Left            =   5400
  74.       MaxLength       =   21
  75.       TabIndex        =   42
  76.       Top             =   3120
  77.       Width           =   2175
  78.    End
  79.    Begin VB.TextBox Phone3Ext 
  80.       Height          =   285
  81.       Left            =   7680
  82.       MaxLength       =   5
  83.       TabIndex        =   40
  84.       Top             =   2760
  85.       Width           =   735
  86.    End
  87.    Begin VB.TextBox Phone3 
  88.       Height          =   285
  89.       Left            =   5400
  90.       MaxLength       =   21
  91.       TabIndex        =   39
  92.       Top             =   2760
  93.       Width           =   2175
  94.    End
  95.    Begin VB.TextBox Phone2Ext 
  96.       Height          =   285
  97.       Left            =   7680
  98.       MaxLength       =   5
  99.       TabIndex        =   37
  100.       Top             =   2400
  101.       Width           =   735
  102.    End
  103.    Begin VB.TextBox Phone2 
  104.       Height          =   285
  105.       Left            =   5400
  106.       MaxLength       =   21
  107.       TabIndex        =   36
  108.       Top             =   2400
  109.       Width           =   2175
  110.    End
  111.    Begin VB.TextBox Phone1Ext 
  112.       Height          =   285
  113.       Left            =   7680
  114.       MaxLength       =   5
  115.       TabIndex        =   34
  116.       Top             =   2040
  117.       Width           =   735
  118.    End
  119.    Begin VB.TextBox Phone1 
  120.       Height          =   285
  121.       Left            =   5400
  122.       MaxLength       =   21
  123.       TabIndex        =   33
  124.       Top             =   2040
  125.       Width           =   2175
  126.    End
  127.    Begin VB.TextBox Country 
  128.       Height          =   285
  129.       Left            =   5400
  130.       MaxLength       =   39
  131.       TabIndex        =   29
  132.       Top             =   1320
  133.       Width           =   2175
  134.    End
  135.    Begin VB.TextBox Zip 
  136.       Height          =   285
  137.       Left            =   5400
  138.       MaxLength       =   19
  139.       TabIndex        =   27
  140.       Top             =   960
  141.       Width           =   2175
  142.    End
  143.    Begin VB.TextBox State 
  144.       Height          =   285
  145.       Left            =   5400
  146.       MaxLength       =   39
  147.       TabIndex        =   25
  148.       Top             =   600
  149.       Width           =   2175
  150.    End
  151.    Begin VB.TextBox City 
  152.       Height          =   285
  153.       Left            =   5400
  154.       MaxLength       =   39
  155.       TabIndex        =   23
  156.       Top             =   240
  157.       Width           =   2175
  158.    End
  159.    Begin VB.TextBox Address2 
  160.       Height          =   285
  161.       Left            =   1440
  162.       MaxLength       =   39
  163.       TabIndex        =   21
  164.       Top             =   3840
  165.       Width           =   2175
  166.    End
  167.    Begin VB.TextBox Address1 
  168.       Height          =   285
  169.       Left            =   1440
  170.       MaxLength       =   39
  171.       TabIndex        =   19
  172.       Top             =   3480
  173.       Width           =   2175
  174.    End
  175.    Begin VB.TextBox Division 
  176.       Height          =   285
  177.       Left            =   1440
  178.       MaxLength       =   39
  179.       TabIndex        =   17
  180.       Top             =   3120
  181.       Width           =   2175
  182.    End
  183.    Begin VB.TextBox Dept 
  184.       Height          =   285
  185.       Left            =   1440
  186.       MaxLength       =   39
  187.       TabIndex        =   15
  188.       Top             =   2760
  189.       Width           =   2175
  190.    End
  191.    Begin VB.TextBox Company 
  192.       Height          =   285
  193.       Left            =   1440
  194.       MaxLength       =   59
  195.       TabIndex        =   13
  196.       Top             =   2400
  197.       Width           =   2175
  198.    End
  199.    Begin VB.TextBox Salutation 
  200.       Height          =   285
  201.       Left            =   1440
  202.       MaxLength       =   39
  203.       TabIndex        =   11
  204.       Top             =   2040
  205.       Width           =   2175
  206.    End
  207.    Begin VB.TextBox Position 
  208.       Height          =   285
  209.       Left            =   1440
  210.       MaxLength       =   59
  211.       TabIndex        =   9
  212.       Top             =   1680
  213.       Width           =   2175
  214.    End
  215.    Begin VB.TextBox LastName 
  216.       Height          =   285
  217.       Left            =   1440
  218.       MaxLength       =   59
  219.       TabIndex        =   7
  220.       Top             =   1320
  221.       Width           =   2175
  222.    End
  223.    Begin VB.TextBox Initial 
  224.       Height          =   285
  225.       Left            =   1440
  226.       MaxLength       =   1
  227.       TabIndex        =   5
  228.       Top             =   960
  229.       Width           =   2175
  230.    End
  231.    Begin VB.TextBox FirstName 
  232.       Height          =   285
  233.       Left            =   1440
  234.       MaxLength       =   39
  235.       TabIndex        =   3
  236.       Top             =   600
  237.       Width           =   2175
  238.    End
  239.    Begin VB.TextBox Mr 
  240.       Height          =   285
  241.       Left            =   1440
  242.       MaxLength       =   39
  243.       TabIndex        =   1
  244.       Top             =   240
  245.       Width           =   2175
  246.    End
  247.    Begin VB.CommandButton Command2 
  248.       Cancel          =   -1  'True
  249.       Caption         =   "Close"
  250.       Height          =   375
  251.       Left            =   7320
  252.       TabIndex        =   45
  253.       Top             =   4560
  254.       Width           =   1095
  255.    End
  256.    Begin VB.CommandButton Command1 
  257.       Caption         =   "&Add"
  258.       Height          =   375
  259.       Left            =   3720
  260.       TabIndex        =   44
  261.       Top             =   4560
  262.       Width           =   1095
  263.    End
  264.    Begin VB.Label Label21 
  265.       Caption         =   "Entry Type"
  266.       Enabled         =   0   'False
  267.       Height          =   255
  268.       Left            =   4080
  269.       TabIndex        =   50
  270.       Top             =   3480
  271.       Width           =   1215
  272.    End
  273.    Begin VB.Label Label20 
  274.       Caption         =   "Phone &4"
  275.       Height          =   255
  276.       Left            =   4080
  277.       TabIndex        =   41
  278.       Top             =   3120
  279.       Width           =   1215
  280.    End
  281.    Begin VB.Label Label19 
  282.       Caption         =   "Phone &3"
  283.       Height          =   255
  284.       Left            =   4080
  285.       TabIndex        =   38
  286.       Top             =   2760
  287.       Width           =   1215
  288.    End
  289.    Begin VB.Label Label18 
  290.       Caption         =   "Phone &2"
  291.       Height          =   255
  292.       Left            =   4080
  293.       TabIndex        =   35
  294.       Top             =   2400
  295.       Width           =   1215
  296.    End
  297.    Begin VB.Label Label17 
  298.       Caption         =   "Phone &1"
  299.       Height          =   255
  300.       Left            =   4080
  301.       TabIndex        =   32
  302.       Top             =   2040
  303.       Width           =   1215
  304.    End
  305.    Begin VB.Label Label16 
  306.       Caption         =   "Identification"
  307.       Enabled         =   0   'False
  308.       Height          =   255
  309.       Left            =   4080
  310.       TabIndex        =   30
  311.       Top             =   1680
  312.       Width           =   1215
  313.    End
  314.    Begin VB.Label Label15 
  315.       Caption         =   "Cou&ntry"
  316.       Height          =   255
  317.       Left            =   4080
  318.       TabIndex        =   28
  319.       Top             =   1320
  320.       Width           =   1215
  321.    End
  322.    Begin VB.Label Label14 
  323.       Caption         =   "&Zip/Postal"
  324.       Height          =   255
  325.       Left            =   4080
  326.       TabIndex        =   26
  327.       Top             =   960
  328.       Width           =   1215
  329.    End
  330.    Begin VB.Label Label13 
  331.       Caption         =   "St&/Prov"
  332.       Height          =   255
  333.       Left            =   4080
  334.       TabIndex        =   24
  335.       Top             =   600
  336.       Width           =   1215
  337.    End
  338.    Begin VB.Label Label12 
  339.       Caption         =   "&City"
  340.       Height          =   255
  341.       Left            =   4080
  342.       TabIndex        =   22
  343.       Top             =   240
  344.       Width           =   1215
  345.    End
  346.    Begin VB.Label Label11 
  347.       Caption         =   "Addre&ss Line 2"
  348.       Height          =   255
  349.       Left            =   120
  350.       TabIndex        =   20
  351.       Top             =   3840
  352.       Width           =   1215
  353.    End
  354.    Begin VB.Label Label10 
  355.       Caption         =   "Add&ress Line 1"
  356.       Height          =   255
  357.       Left            =   120
  358.       TabIndex        =   18
  359.       Top             =   3480
  360.       Width           =   1215
  361.    End
  362.    Begin VB.Label Label9 
  363.       Caption         =   "Di&vision"
  364.       Height          =   255
  365.       Left            =   120
  366.       TabIndex        =   16
  367.       Top             =   3120
  368.       Width           =   1215
  369.    End
  370.    Begin VB.Label Label8 
  371.       Caption         =   "D&ept"
  372.       Height          =   255
  373.       Left            =   120
  374.       TabIndex        =   14
  375.       Top             =   2760
  376.       Width           =   1215
  377.    End
  378.    Begin VB.Label Label7 
  379.       Caption         =   "Compan&y Name"
  380.       Height          =   255
  381.       Left            =   120
  382.       TabIndex        =   12
  383.       Top             =   2400
  384.       Width           =   1215
  385.    End
  386.    Begin VB.Label Label6 
  387.       Caption         =   "Salu&tation"
  388.       Height          =   255
  389.       Left            =   120
  390.       TabIndex        =   10
  391.       Top             =   2040
  392.       Width           =   1215
  393.    End
  394.    Begin VB.Label Label5 
  395.       Caption         =   "P&osition"
  396.       Height          =   255
  397.       Left            =   120
  398.       TabIndex        =   8
  399.       Top             =   1680
  400.       Width           =   1215
  401.    End
  402.    Begin VB.Label Label4 
  403.       Caption         =   "&Last Name"
  404.       Height          =   255
  405.       Left            =   120
  406.       TabIndex        =   6
  407.       Top             =   1320
  408.       Width           =   1215
  409.    End
  410.    Begin VB.Label Label3 
  411.       Caption         =   "&Initial"
  412.       Height          =   255
  413.       Left            =   120
  414.       TabIndex        =   4
  415.       Top             =   960
  416.       Width           =   1215
  417.    End
  418.    Begin VB.Label Label2 
  419.       Caption         =   "&First Name"
  420.       Height          =   255
  421.       Left            =   120
  422.       TabIndex        =   2
  423.       Top             =   600
  424.       Width           =   1215
  425.    End
  426.    Begin VB.Label Label1 
  427.       Caption         =   "&Mr/Ms"
  428.       Height          =   255
  429.       Left            =   120
  430.       TabIndex        =   0
  431.       Top             =   240
  432.       Width           =   1215
  433.    End
  434. End
  435. Attribute VB_Name = "Persform"
  436. Attribute VB_GlobalNameSpace = False
  437. Attribute VB_Creatable = False
  438. Attribute VB_PredeclaredId = True
  439. Attribute VB_Exposed = False
  440. '==========================================================================
  441. '
  442. '  This code and information is provided "as is" without warranty of any
  443. '  kind, either expressed or implied, including but not limited to the
  444. '  implied warranties of merchantability and/or fitness for a particular
  445. '  purpose..
  446. '
  447. '  Copyright (c) 1998  Multiactive Software Inc.  All Rights Reserved.
  448. '
  449. '==========================================================================
  450.  
  451.  
  452. Private Sub Command1_Click()  'Add
  453. Load Choice 'Load the Choice form
  454. Choice.Show (1) 'show Choice form with modal mode
  455.  
  456. If Not ClientInsertType = 0 Then    'If the user not clicking Cancel in the choice form
  457.     Persform.Hide   'Hide the Persform in memory but not display
  458.     Load Insform    'Load the Insform for inserting a new entry
  459.     Insform.Show    'Show the Insform form
  460.     Set ClientForm = Persform
  461.     Call ClearFields        'Clear all the fields
  462.     Set ClientForm = Nothing
  463.     If rectype = 1 Then         'If the entry is company
  464.         Set ClientForm = Persform
  465.         Call Companyfill(1)     'fill in the fields
  466.         Set ClientForm = Nothing
  467.     Else
  468.         Set ClientForm = Persform
  469.         Call Personfill(1)      'fill in the fields
  470.         Set ClientForm = Nothing
  471.     End If
  472. End If
  473. End Sub
  474.  
  475. Private Sub Command2_Click()  'Close
  476.     dbsrecClient.Close
  477.     Unload Me   'User chose Cancel, so Unload the form without doing anything
  478. End Sub
  479.  
  480. Private Sub Command3_Click()  'Update
  481.     If rectype = 1 Then Call UpdateCompany      'If company
  482.     If rectype = 2 Then Call UpdateIndividual   'If individual
  483.     If rectype = 31 Or rectype = 32 Then Call UpdateContact 'If contact
  484. End Sub
  485.  
  486. Private Sub Command4_Click()  'Delete
  487.     Call DeleteClient     'Call the function to delete the current entry
  488.     Set ClientForm = Persform
  489.     Call ClearFields
  490.     Set ClientForm = Nothing
  491.     dbsrecClient.MoveFirst      'Move back to the first entry
  492.         
  493.     If Not dbsrecClient.Fields(0) = "" Then 'reassign the data
  494.     ci = dbsrecClient.Fields(0)
  495.     cn = dbsrecClient.Fields(1)
  496.     rectype = dbsrecClient.Fields(2)
  497.     ai = dbsrecClient.Fields(3)
  498.     If rectype = 1 Then     'If Company
  499.         Set ClientForm = Persform
  500.         Call Companyfill(1)     'Fill in the fields
  501.         Set ClientForm = Nothing
  502.     Else
  503.         Set ClientForm = Persform
  504.         Call Personfill(1)      'Fill in the fields
  505.         Set ClientForm = Nothing
  506.     End If
  507.     End If
  508. End Sub
  509.  
  510. Private Sub Command5_Click()  'Next
  511.     Set ClientForm = Persform
  512.     Call ClearFields
  513.     Set ClientForm = Nothing
  514.     dbsrecClient.MoveNext       'Move to the next record
  515.     If dbsrecClient.EOF Then    'If end
  516.        MsgBox ("End of the file!  Now go back to the first client.")
  517.        dbsrecClient.MoveFirst   'Back to the first record
  518.     End If
  519.  
  520.  
  521.     If Not dbsrecClient.Fields(0) = "" Then 'reassign the data
  522.     ci = dbsrecClient.Fields(0)
  523.     cn = dbsrecClient.Fields(1)
  524.     rectype = dbsrecClient.Fields(2)
  525.     ai = dbsrecClient.Fields(3)
  526.     
  527.     If rectype = 1 Then     'If company
  528.         Set ClientForm = Persform
  529.         Call Companyfill(1)     'Fill in the fields
  530.         Set ClientForm = Nothing
  531.     Else
  532.         Set ClientForm = Persform
  533.         Call Personfill(1)      'Fill in the fields
  534.     End If
  535.     End If
  536. End Sub
  537.  
  538. Private Sub Command6_Click()  'Previous
  539.     Set ClientForm = Persform
  540.     Call ClearFields
  541.     Set ClientForm = Nothing
  542.     dbsrecClient.MovePrevious   'Move to the Previous record
  543.     If dbsrecClient.BOF Then    'If beginning
  544.          MsgBox ("Beginning of the file!  Now go to the last client.")
  545.          dbsrecClient.MoveLast
  546.     End If
  547.                   
  548.     If Not dbsrecClient.Fields(0) = "" Then 'reassign the data
  549.     ci = dbsrecClient.Fields(0)
  550.     cn = dbsrecClient.Fields(1)
  551.     rectype = dbsrecClient.Fields(2)
  552.     ai = dbsrecClient.Fields(3)
  553.     
  554.     If rectype = 1 Then 'If company
  555.         Set ClientForm = Persform
  556.         Call Companyfill(1)     'Fill in the fields
  557.         Set ClientForm = Nothing
  558.     Else
  559.         Set ClientForm = Persform
  560.         Call Personfill(1)      'Fill in the fields
  561.         Set ClientForm = Nothing
  562.     End If
  563.     End If
  564.  
  565. End Sub
  566.  
  567. Private Sub Form_Load()
  568.     
  569.     'To get all entry unique data
  570.     Set dbsrecClient = dbs.OpenRecordset("SELECT Client_Id, Contact_Number, Record_Type, Address_Id FROM Client")
  571.     dbsrecClient.MoveFirst      'Move to the first record when loading
  572.     ci = dbsrecClient.Fields(0)
  573.     cn = dbsrecClient.Fields(1)
  574.     rectype = dbsrecClient.Fields(2)
  575.     ai = dbsrecClient.Fields(3)
  576.     
  577.     If rectype = 1 Then 'If company
  578.         Set ClientForm = Persform
  579.         Call Companyfill(1) 'Fill in the fields
  580.         Set ClientForm = Nothing
  581.     Else
  582.         Set ClientForm = Persform
  583.         Call Personfill(1)  'Fill in the fields
  584.         Set ClientForm = Nothing
  585.     End If
  586.  
  587.     Unload frmODBCLogon     'Terminate the Login form
  588.     Persform.Show           'Show this form
  589. End Sub
  590.  
  591. Private Sub Mr_GotFocus()
  592. Call SelText(Persform.Mr, 40) 'Call function to Highlight text in this field.
  593. End Sub
  594.  
  595. Private Sub FirstName_GotFocus()
  596. Call SelText(Persform.FirstName, 40) 'Call function to Highlight text in this field.
  597. End Sub
  598.  
  599. Private Sub Initial_GotFocus()
  600. Call SelText(Persform.Initial, 2) 'Call function to Highlight text in this field.
  601. End Sub
  602.  
  603. Private Sub LastName_GotFocus()
  604. Call SelText(Persform.LastName, 60) 'Call function to Highlight text in this field.
  605. End Sub
  606.  
  607. Private Sub Position_GotFocus()
  608. Call SelText(Persform.Position, 60) 'Call function to Highlight text in this field.
  609. End Sub
  610.  
  611. Private Sub Salutation_GotFocus()
  612. Call SelText(Persform.Salutation, 40) 'Call function to Highlight text in this field.
  613. End Sub
  614.  
  615. Private Sub Company_GotFocus()
  616. Call SelText(Persform.Company, 60) 'Call function to Highlight text in this field.
  617. End Sub
  618.  
  619. Private Sub Dept_GotFocus()
  620. Call SelText(Persform.Dept, 40) 'Call function to Highlight text in this field.
  621. End Sub
  622.  
  623. Private Sub Division_GotFocus()
  624. Call SelText(Persform.Division, 40) 'Call function to Highlight text in this field.
  625. End Sub
  626.  
  627. Private Sub Address1_GotFocus()
  628. Call SelText(Persform.Address1, 40) 'Call function to Highlight text in this field.
  629. End Sub
  630.  
  631. Private Sub Address2_GotFocus()
  632. Call SelText(Persform.Address2, 40) 'Call function to Highlight text in this field.
  633. End Sub
  634.  
  635. Private Sub City_GotFocus()
  636. Call SelText(Persform.City, 40) 'Call function to Highlight text in this field.
  637. End Sub
  638.  
  639. Private Sub State_GotFocus()
  640. Call SelText(Persform.State, 40) 'Call function to Highlight text in this field.
  641. End Sub
  642.  
  643. Private Sub Zip_GotFocus()
  644. Call SelText(Persform.Zip, 20) 'Call function to Highlight text in this field.
  645. End Sub
  646.  
  647. Private Sub Country_GotFocus()
  648. Call SelText(Persform.Country, 40) 'Call function to Highlight text in this field.
  649. End Sub
  650.  
  651. Private Sub Phone1_GotFocus()
  652. Call SelText(Persform.Phone1, 22) 'Call function to Highlight text in this field.
  653. End Sub
  654.  
  655. Private Sub Phone2_GotFocus()
  656. Call SelText(Persform.Phone2, 22) 'Call function to Highlight text in this field.
  657. End Sub
  658.  
  659. Private Sub Phone3_GotFocus()
  660. Call SelText(Persform.Phone3, 22) 'Call function to Highlight text in this field.
  661. End Sub
  662.  
  663. Private Sub Phone4_GotFocus()
  664. Call SelText(Persform.Phone4, 22) 'Call function to Highlight text in this field.
  665. End Sub
  666.  
  667. Private Sub Phone1Ext_GotFocus()
  668. Call SelText(Persform.Phone1Ext, 6) 'Call function to Highlight text in this field.
  669. End Sub
  670.  
  671. Private Sub Phone2Ext_GotFocus()
  672. Call SelText(Persform.Phone2Ext, 6) 'Call function to Highlight text in this field.
  673. End Sub
  674.  
  675. Private Sub Phone3Ext_GotFocus()
  676. Call SelText(Persform.Phone3Ext, 6) 'Call function to Highlight text in this field.
  677. End Sub
  678.  
  679. Private Sub Phone4Ext_GotFocus()
  680. Call SelText(Persform.Phone4Ext, 6) 'Call function to Highlight text in this field.
  681. End Sub
  682.