home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / address / address.frm next >
Text File  |  1993-07-05  |  51KB  |  1,794 lines

  1. VERSION 2.00
  2. Begin Form Address 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Mike's Address"
  5.    ClientHeight    =   5355
  6.    ClientLeft      =   2115
  7.    ClientTop       =   1410
  8.    ClientWidth     =   5175
  9.    Height          =   6045
  10.    Icon            =   ADDRESS.FRX:0000
  11.    Left            =   2055
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   5355
  15.    ScaleWidth      =   5175
  16.    Top             =   780
  17.    Width           =   5295
  18.    Begin Timer Timer1 
  19.       Enabled         =   0   'False
  20.       Interval        =   1000
  21.       Left            =   4560
  22.       Top             =   2520
  23.    End
  24.    Begin SSCommand Command3D3 
  25.       BevelWidth      =   4
  26.       Caption         =   "&Voice"
  27.       Font3D          =   3  'Inset w/light shading
  28.       Height          =   375
  29.       Left            =   120
  30.       TabIndex        =   34
  31.       Top             =   4920
  32.       Width           =   855
  33.    End
  34.    Begin ListBox List2 
  35.       FontBold        =   -1  'True
  36.       FontItalic      =   0   'False
  37.       FontName        =   "Arial"
  38.       FontSize        =   8.25
  39.       FontStrikethru  =   0   'False
  40.       FontUnderline   =   0   'False
  41.       Height          =   450
  42.       Left            =   1080
  43.       TabIndex        =   11
  44.       Top             =   4725
  45.       Width           =   3975
  46.    End
  47.    Begin ListBox List1 
  48.       FontBold        =   -1  'True
  49.       FontItalic      =   0   'False
  50.       FontName        =   "Arial"
  51.       FontSize        =   8.25
  52.       FontStrikethru  =   0   'False
  53.       FontUnderline   =   0   'False
  54.       Height          =   3180
  55.       Left            =   5280
  56.       TabIndex        =   27
  57.       TabStop         =   0   'False
  58.       Top             =   480
  59.       Visible         =   0   'False
  60.       Width           =   1215
  61.    End
  62.    Begin CommandButton Command1 
  63.       Caption         =   "|>"
  64.       FontBold        =   -1  'True
  65.       FontItalic      =   0   'False
  66.       FontName        =   "MS Serif"
  67.       FontSize        =   9.75
  68.       FontStrikethru  =   0   'False
  69.       FontUnderline   =   0   'False
  70.       Height          =   275
  71.       Index           =   3
  72.       Left            =   4875
  73.       TabIndex        =   26
  74.       TabStop         =   0   'False
  75.       Top             =   4440
  76.       Visible         =   0   'False
  77.       Width           =   300
  78.    End
  79.    Begin CommandButton Command1 
  80.       Caption         =   ">"
  81.       FontBold        =   -1  'True
  82.       FontItalic      =   0   'False
  83.       FontName        =   "MS Serif"
  84.       FontSize        =   9.75
  85.       FontStrikethru  =   0   'False
  86.       FontUnderline   =   0   'False
  87.       Height          =   275
  88.       Index           =   2
  89.       Left            =   4580
  90.       TabIndex        =   25
  91.       TabStop         =   0   'False
  92.       Top             =   4440
  93.       Visible         =   0   'False
  94.       Width           =   300
  95.    End
  96.    Begin CommandButton Command1 
  97.       Caption         =   "<"
  98.       FontBold        =   -1  'True
  99.       FontItalic      =   0   'False
  100.       FontName        =   "MS Serif"
  101.       FontSize        =   9.75
  102.       FontStrikethru  =   0   'False
  103.       FontUnderline   =   0   'False
  104.       Height          =   275
  105.       Index           =   1
  106.       Left            =   285
  107.       TabIndex        =   24
  108.       TabStop         =   0   'False
  109.       Top             =   4440
  110.       Visible         =   0   'False
  111.       Width           =   300
  112.    End
  113.    Begin CommandButton Command1 
  114.       Caption         =   "|<"
  115.       FontBold        =   -1  'True
  116.       FontItalic      =   0   'False
  117.       FontName        =   "MS Serif"
  118.       FontSize        =   9.75
  119.       FontStrikethru  =   0   'False
  120.       FontUnderline   =   0   'False
  121.       Height          =   275
  122.       Index           =   0
  123.       Left            =   0
  124.       TabIndex        =   23
  125.       TabStop         =   0   'False
  126.       Top             =   4440
  127.       Visible         =   0   'False
  128.       Width           =   300
  129.    End
  130.    Begin Data Data1 
  131.       Caption         =   "Data1"
  132.       Connect         =   ""
  133.       DatabaseName    =   ""
  134.       Exclusive       =   0   'False
  135.       Height          =   270
  136.       Left            =   0
  137.       Options         =   0
  138.       ReadOnly        =   0   'False
  139.       RecordSource    =   ""
  140.       Top             =   4440
  141.       Width           =   5175
  142.    End
  143.    Begin SSPanel Panel3D1 
  144.       Alignment       =   6  'Center - TOP
  145.       BackColor       =   &H00C0C0C0&
  146.       BevelInner      =   2  'Raised
  147.       BorderWidth     =   1
  148.       Font3D          =   3  'Inset w/light shading
  149.       FontBold        =   -1  'True
  150.       FontItalic      =   0   'False
  151.       FontName        =   "Arial"
  152.       FontSize        =   8.25
  153.       FontStrikethru  =   0   'False
  154.       FontUnderline   =   0   'False
  155.       Height          =   4455
  156.       Left            =   0
  157.       TabIndex        =   12
  158.       Top             =   0
  159.       Width           =   5175
  160.       Begin SSCommand Command3D2 
  161.          Caption         =   "&Update"
  162.          Font3D          =   3  'Inset w/light shading
  163.          FontBold        =   -1  'True
  164.          FontItalic      =   0   'False
  165.          FontName        =   "Arial"
  166.          FontSize        =   8.25
  167.          FontStrikethru  =   0   'False
  168.          FontUnderline   =   0   'False
  169.          Height          =   255
  170.          Left            =   3360
  171.          TabIndex        =   30
  172.          Top             =   0
  173.          Width           =   855
  174.       End
  175.       Begin SSCommand Command3D1 
  176.          Caption         =   "&Cancel"
  177.          Font3D          =   3  'Inset w/light shading
  178.          FontBold        =   -1  'True
  179.          FontItalic      =   0   'False
  180.          FontName        =   "Arial"
  181.          FontSize        =   8.25
  182.          FontStrikethru  =   0   'False
  183.          FontUnderline   =   0   'False
  184.          Height          =   255
  185.          Left            =   4200
  186.          TabIndex        =   31
  187.          Top             =   0
  188.          Width           =   855
  189.       End
  190.       Begin TextBox Text11 
  191.          DataField       =   "tAlpha"
  192.          DataSource      =   "Data1"
  193.          FontBold        =   -1  'True
  194.          FontItalic      =   0   'False
  195.          FontName        =   "Courier"
  196.          FontSize        =   9.75
  197.          FontStrikethru  =   0   'False
  198.          FontUnderline   =   0   'False
  199.          Height          =   360
  200.          Left            =   4200
  201.          MaxLength       =   5
  202.          TabIndex        =   5
  203.          Text            =   "tAlph"
  204.          Top             =   1680
  205.          Width           =   855
  206.       End
  207.       Begin TextBox Text10 
  208.          DataField       =   "tRegion"
  209.          DataSource      =   "Data1"
  210.          FontBold        =   -1  'True
  211.          FontItalic      =   0   'False
  212.          FontName        =   "Courier"
  213.          FontSize        =   9.75
  214.          FontStrikethru  =   0   'False
  215.          FontUnderline   =   0   'False
  216.          Height          =   360
  217.          Left            =   1800
  218.          MaxLength       =   15
  219.          TabIndex        =   7
  220.          Text            =   "tRegion"
  221.          Top             =   2280
  222.          Width           =   2175
  223.       End
  224.       Begin TextBox Text9 
  225.          DataField       =   "tPhone"
  226.          DataSource      =   "Data1"
  227.          FontBold        =   -1  'True
  228.          FontItalic      =   0   'False
  229.          FontName        =   "Courier"
  230.          FontSize        =   9.75
  231.          FontStrikethru  =   0   'False
  232.          FontUnderline   =   0   'False
  233.          Height          =   360
  234.          Left            =   120
  235.          MaxLength       =   35
  236.          TabIndex        =   10
  237.          Text            =   "tPhone"
  238.          Top             =   4080
  239.          Width           =   4935
  240.       End
  241.       Begin TextBox Text8 
  242.          DataField       =   "tInfo"
  243.          DataSource      =   "Data1"
  244.          FontBold        =   -1  'True
  245.          FontItalic      =   0   'False
  246.          FontName        =   "Courier"
  247.          FontSize        =   9.75
  248.          FontStrikethru  =   0   'False
  249.          FontUnderline   =   0   'False
  250.          Height          =   360
  251.          Left            =   120
  252.          MaxLength       =   35
  253.          TabIndex        =   9
  254.          Text            =   "tInfo"
  255.          Top             =   3480
  256.          Width           =   4935
  257.       End
  258.       Begin TextBox Text7 
  259.          DataField       =   "tMessage"
  260.          DataSource      =   "Data1"
  261.          FontBold        =   -1  'True
  262.          FontItalic      =   0   'False
  263.          FontName        =   "Courier"
  264.          FontSize        =   9.75
  265.          FontStrikethru  =   0   'False
  266.          FontUnderline   =   0   'False
  267.          Height          =   360
  268.          Left            =   120
  269.          MaxLength       =   35
  270.          TabIndex        =   8
  271.          Text            =   "tMessage"
  272.          Top             =   2880
  273.          Width           =   4935
  274.       End
  275.       Begin TextBox Text6 
  276.          DataField       =   "tZip"
  277.          DataSource      =   "Data1"
  278.          FontBold        =   -1  'True
  279.          FontItalic      =   0   'False
  280.          FontName        =   "Courier"
  281.          FontSize        =   9.75
  282.          FontStrikethru  =   0   'False
  283.          FontUnderline   =   0   'False
  284.          Height          =   360
  285.          Left            =   120
  286.          MaxLength       =   10
  287.          TabIndex        =   6
  288.          Text            =   "tZip"
  289.          Top             =   2280
  290.          Width           =   1575
  291.       End
  292.       Begin TextBox Text5 
  293.          DataField       =   "tState"
  294.          DataSource      =   "Data1"
  295.          FontBold        =   -1  'True
  296.          FontItalic      =   0   'False
  297.          FontName        =   "Courier"
  298.          FontSize        =   9.75
  299.          FontStrikethru  =   0   'False
  300.          FontUnderline   =   0   'False
  301.          Height          =   360
  302.          Left            =   3120
  303.          MaxLength       =   6
  304.          TabIndex        =   4
  305.          Text            =   "tState"
  306.          Top             =   1680
  307.          Width           =   975
  308.       End
  309.       Begin TextBox Text4 
  310.          DataField       =   "tCity"
  311.          DataSource      =   "Data1"
  312.          FontBold        =   -1  'True
  313.          FontItalic      =   0   'False
  314.          FontName        =   "Courier"
  315.          FontSize        =   9.75
  316.          FontStrikethru  =   0   'False
  317.          FontUnderline   =   0   'False
  318.          Height          =   360
  319.          Left            =   120
  320.          MaxLength       =   20
  321.          TabIndex        =   3
  322.          Text            =   "tCity"
  323.          Top             =   1680
  324.          Width           =   2895
  325.       End
  326.       Begin TextBox Text3 
  327.          DataField       =   "tStreet2"
  328.          DataSource      =   "Data1"
  329.          FontBold        =   -1  'True
  330.          FontItalic      =   0   'False
  331.          FontName        =   "Courier"
  332.          FontSize        =   9.75
  333.          FontStrikethru  =   0   'False
  334.          FontUnderline   =   0   'False
  335.          Height          =   360
  336.          Left            =   120
  337.          MaxLength       =   35
  338.          TabIndex        =   2
  339.          Text            =   "tStreet2"
  340.          Top             =   1090
  341.          Width           =   4935
  342.       End
  343.       Begin TextBox Text2 
  344.          DataField       =   "tStreet1"
  345.          DataSource      =   "Data1"
  346.          FontBold        =   -1  'True
  347.          FontItalic      =   0   'False
  348.          FontName        =   "Courier"
  349.          FontSize        =   9.75
  350.          FontStrikethru  =   0   'False
  351.          FontUnderline   =   0   'False
  352.          Height          =   360
  353.          Left            =   120
  354.          MaxLength       =   35
  355.          TabIndex        =   1
  356.          Text            =   "tStreet1"
  357.          Top             =   840
  358.          Width           =   4935
  359.       End
  360.       Begin TextBox Text1 
  361.          DataField       =   "tName"
  362.          DataSource      =   "Data1"
  363.          FontBold        =   -1  'True
  364.          FontItalic      =   0   'False
  365.          FontName        =   "Courier"
  366.          FontSize        =   9.75
  367.          FontStrikethru  =   0   'False
  368.          FontUnderline   =   0   'False
  369.          Height          =   360
  370.          Left            =   120
  371.          MaxLength       =   35
  372.          TabIndex        =   0
  373.          Text            =   "tName"
  374.          Top             =   240
  375.          Width           =   4935
  376.       End
  377.       Begin Label Label12 
  378.          AutoSize        =   -1  'True
  379.          BackStyle       =   0  'Transparent
  380.          Caption         =   "Last Update:"
  381.          FontBold        =   -1  'True
  382.          FontItalic      =   0   'False
  383.          FontName        =   "Arial"
  384.          FontSize        =   8.25
  385.          FontStrikethru  =   0   'False
  386.          FontUnderline   =   0   'False
  387.          ForeColor       =   &H00800000&
  388.          Height          =   210
  389.          Left            =   4080
  390.          TabIndex        =   29
  391.          Top             =   2040
  392.          Width           =   1020
  393.       End
  394.       Begin Label Label11 
  395.          AutoSize        =   -1  'True
  396.          BackStyle       =   0  'Transparent
  397.          Caption         =   "00-00-0000"
  398.          DataField       =   "tDate"
  399.          DataSource      =   "Data1"
  400.          FontBold        =   -1  'True
  401.          FontItalic      =   0   'False
  402.          FontName        =   "Arial"
  403.          FontSize        =   8.25
  404.          FontStrikethru  =   0   'False
  405.          FontUnderline   =   0   'False
  406.          ForeColor       =   &H00800000&
  407.          Height          =   210
  408.          Left            =   4080
  409.          TabIndex        =   28
  410.          Top             =   2280
  411.          Width           =   840
  412.       End
  413.       Begin Label Label10 
  414.          AutoSize        =   -1  'True
  415.          BackStyle       =   0  'Transparent
  416.          Caption         =   "Order:"
  417.          FontBold        =   -1  'True
  418.          FontItalic      =   0   'False
  419.          FontName        =   "Arial"
  420.          FontSize        =   8.25
  421.          FontStrikethru  =   0   'False
  422.          FontUnderline   =   0   'False
  423.          Height          =   210
  424.          Left            =   4200
  425.          TabIndex        =   22
  426.          Top             =   1440
  427.          Width           =   525
  428.       End
  429.       Begin Label Label9 
  430.          AutoSize        =   -1  'True
  431.          BackStyle       =   0  'Transparent
  432.          Caption         =   "Country:"
  433.          FontBold        =   -1  'True
  434.          FontItalic      =   0   'False
  435.          FontName        =   "Arial"
  436.          FontSize        =   8.25
  437.          FontStrikethru  =   0   'False
  438.          FontUnderline   =   0   'False
  439.          Height          =   210
  440.          Left            =   1800
  441.          TabIndex        =   21
  442.          Top             =   2040
  443.          Width           =   705
  444.       End
  445.       Begin Label Label8 
  446.          AutoSize        =   -1  'True
  447.          BackStyle       =   0  'Transparent
  448.          Caption         =   "Phone:"
  449.          FontBold        =   -1  'True
  450.          FontItalic      =   0   'False
  451.          FontName        =   "Arial"
  452.          FontSize        =   8.25
  453.          FontStrikethru  =   0   'False
  454.          FontUnderline   =   0   'False
  455.          Height          =   210
  456.          Left            =   120
  457.          TabIndex        =   20
  458.          Top             =   3840
  459.          Width           =   570
  460.       End
  461.       Begin Label Label7 
  462.          AutoSize        =   -1  'True
  463.          BackStyle       =   0  'Transparent
  464.          Caption         =   "Information:"
  465.          FontBold        =   -1  'True
  466.          FontItalic      =   0   'False
  467.          FontName        =   "Arial"
  468.          FontSize        =   8.25
  469.          FontStrikethru  =   0   'False
  470.          FontUnderline   =   0   'False
  471.          Height          =   210
  472.          Left            =   120
  473.          TabIndex        =   19
  474.          Top             =   3240
  475.          Width           =   1005
  476.       End
  477.       Begin Label Label6 
  478.          AutoSize        =   -1  'True
  479.          BackStyle       =   0  'Transparent
  480.          Caption         =   "Message:"
  481.          FontBold        =   -1  'True
  482.          FontItalic      =   0   'False
  483.          FontName        =   "Arial"
  484.          FontSize        =   8.25
  485.          FontStrikethru  =   0   'False
  486.          FontUnderline   =   0   'False
  487.          Height          =   210
  488.          Left            =   120
  489.          TabIndex        =   18
  490.          Top             =   2640
  491.          Width           =   810
  492.       End
  493.       Begin Label Label5 
  494.          AutoSize        =   -1  'True
  495.          BackStyle       =   0  'Transparent
  496.          Caption         =   "Zip Code:"
  497.          FontBold        =   -1  'True
  498.          FontItalic      =   0   'False
  499.          FontName        =   "Arial"
  500.          FontSize        =   8.25
  501.          FontStrikethru  =   0   'False
  502.          FontUnderline   =   0   'False
  503.          Height          =   210
  504.          Left            =   120
  505.          TabIndex        =   17
  506.          Top             =   2040
  507.          Width           =   780
  508.       End
  509.       Begin Label Label4 
  510.          AutoSize        =   -1  'True
  511.          BackStyle       =   0  'Transparent
  512.          Caption         =   "State:"
  513.          FontBold        =   -1  'True
  514.          FontItalic      =   0   'False
  515.          FontName        =   "Arial"
  516.          FontSize        =   8.25
  517.          FontStrikethru  =   0   'False
  518.          FontUnderline   =   0   'False
  519.          Height          =   210
  520.          Left            =   3120
  521.          TabIndex        =   16
  522.          Top             =   1440
  523.          Width           =   465
  524.       End
  525.       Begin Label Label3 
  526.          AutoSize        =   -1  'True
  527.          BackStyle       =   0  'Transparent
  528.          Caption         =   "City:"
  529.          FontBold        =   -1  'True
  530.          FontItalic      =   0   'False
  531.          FontName        =   "Arial"
  532.          FontSize        =   8.25
  533.          FontStrikethru  =   0   'False
  534.          FontUnderline   =   0   'False
  535.          Height          =   210
  536.          Left            =   120
  537.          TabIndex        =   15
  538.          Top             =   1440
  539.          Width           =   360
  540.       End
  541.       Begin Label Label2 
  542.          AutoSize        =   -1  'True
  543.          BackStyle       =   0  'Transparent
  544.          Caption         =   "Street Address:"
  545.          FontBold        =   -1  'True
  546.          FontItalic      =   0   'False
  547.          FontName        =   "Arial"
  548.          FontSize        =   8.25
  549.          FontStrikethru  =   0   'False
  550.          FontUnderline   =   0   'False
  551.          Height          =   210
  552.          Left            =   120
  553.          TabIndex        =   14
  554.          Top             =   600
  555.          Width           =   1320
  556.       End
  557.       Begin Label Label1 
  558.          AutoSize        =   -1  'True
  559.          BackStyle       =   0  'Transparent
  560.          Caption         =   "Name:"
  561.          FontBold        =   -1  'True
  562.          FontItalic      =   0   'False
  563.          FontName        =   "Arial"
  564.          FontSize        =   8.25
  565.          FontStrikethru  =   0   'False
  566.          FontUnderline   =   0   'False
  567.          Height          =   210
  568.          Left            =   120
  569.          TabIndex        =   13
  570.          Top             =   0
  571.          Width           =   510
  572.       End
  573.    End
  574.    Begin Label Label14 
  575.       DataField       =   "tVoice"
  576.       DataSource      =   "Data1"
  577.       Height          =   255
  578.       Left            =   120
  579.       TabIndex        =   33
  580.       Top             =   5040
  581.       Visible         =   0   'False
  582.       Width           =   855
  583.    End
  584.    Begin Label Label13 
  585.       AutoSize        =   -1  'True
  586.       BackStyle       =   0  'Transparent
  587.       Caption         =   "Name List:"
  588.       FontBold        =   -1  'True
  589.       FontItalic      =   0   'False
  590.       FontName        =   "Arial"
  591.       FontSize        =   8.25
  592.       FontStrikethru  =   0   'False
  593.       FontUnderline   =   0   'False
  594.       Height          =   210
  595.       Left            =   120
  596.       TabIndex        =   32
  597.       Top             =   4725
  598.       Width           =   870
  599.    End
  600.    Begin Menu MenuFile 
  601.       Caption         =   "&File"
  602.       Begin Menu MenuAddRecord 
  603.          Caption         =   "&Add Record"
  604.       End
  605.       Begin Menu MenuDeleteRecord 
  606.          Caption         =   "&Delete Record"
  607.       End
  608.       Begin Menu MenuBrowseRecords 
  609.          Caption         =   "&Browse Records"
  610.       End
  611.       Begin Menu MenuSearchRecords 
  612.          Caption         =   "&Search Records"
  613.       End
  614.       Begin Menu Hash1 
  615.          Caption         =   "-"
  616.       End
  617.       Begin Menu MenuExit 
  618.          Caption         =   "E&xit"
  619.       End
  620.    End
  621.    Begin Menu MenuEdit 
  622.       Caption         =   "&Edit"
  623.       Begin Menu MenuCut 
  624.          Caption         =   "&Cut"
  625.       End
  626.       Begin Menu MenuCopy 
  627.          Caption         =   "C&opy"
  628.       End
  629.       Begin Menu MenuPaste 
  630.          Caption         =   "&Paste"
  631.       End
  632.       Begin Menu MenuClear 
  633.          Caption         =   "C&lear"
  634.       End
  635.       Begin Menu Hash2 
  636.          Caption         =   "-"
  637.       End
  638.       Begin Menu MenuCopyAddress 
  639.          Caption         =   "Copy &Address"
  640.       End
  641.    End
  642.    Begin Menu MenuPrint 
  643.       Caption         =   "&Print"
  644.       Begin Menu MenuNameList 
  645.          Caption         =   "&Name List"
  646.       End
  647.       Begin Menu MenuNamePhoneList 
  648.          Caption         =   "Name && &Phone List"
  649.          Begin Menu MenuOneList 
  650.             Caption         =   "&One Line"
  651.          End
  652.          Begin Menu MenuTwoList 
  653.             Caption         =   "&Two Lines"
  654.          End
  655.       End
  656.    End
  657.    Begin Menu MenuVoice 
  658.       Caption         =   "V&oice"
  659.       Begin Menu MenuRecordVoice 
  660.          Caption         =   "&Record"
  661.       End
  662.       Begin Menu MenuDeleteVoice 
  663.          Caption         =   "&Delete"
  664.       End
  665.    End
  666.    Begin Menu MenuPhone 
  667.       Caption         =   "P&hone"
  668.       Begin Menu MenuDial 
  669.          Caption         =   "&Dial"
  670.       End
  671.       Begin Menu MenuSetup 
  672.          Caption         =   "&SetUp"
  673.       End
  674.    End
  675.    Begin Menu MenuDatabase 
  676.       Caption         =   "&DataBase"
  677.       Begin Menu MenuCompact 
  678.          Caption         =   "&Compact"
  679.       End
  680.    End
  681. End
  682. Dim CurrRec As Long
  683. Dim DBName As String
  684. Dim SkipIt As Integer
  685. Dim CancelFlag As Integer
  686. Dim ABM As String
  687. Dim MyRec As Long
  688. Dim TotRec As Long
  689. Dim AlreadySet As Integer
  690. Dim SearchFlag As Integer
  691. Dim CallString As String
  692. Dim OkSize As Integer
  693.  
  694. Sub Command1_Click (Index As Integer)
  695. 'Our Buttons try to simulate the data control buttons
  696. 'This helps to keep the recordset in order
  697.  
  698. UpdateTheRecord
  699. Select Case Index
  700.     Case 0
  701.         If MyRec <> 1 Then Data1.Recordset.MoveFirst
  702.     Case 1
  703.         If MyRec <> 1 Then Data1.Recordset.MovePrevious
  704.     Case 2
  705.         If MyRec <> TotRec Then Data1.Recordset.MoveNext
  706.     Case 3
  707.         If MyRec <> TotRec Then Data1.Recordset.MoveLast
  708. End Select
  709. End Sub
  710.  
  711. Sub Command3D1_Click ()
  712. CancelFlag = True       'cancelflag set to stop update
  713. If Label14.Caption <> "" Then   'make sure delete any wav file saved
  714.     xx$ = Label14.Caption
  715.     On Error Resume Next
  716.     Kill xx$
  717. End If
  718. If ABM <> "" Then   'this tells us if recordset has any records
  719.     Data1.Recordset.Bookmark = ABM
  720.     Command3D1.Visible = False
  721.     Command3D2.Visible = False
  722.     MenuAddRecord.Enabled = True
  723.     MenuDeleteRecord.Enabled = True
  724.     If SearchFlag Then
  725.         MenuSearchRecords.Enabled = False
  726.         MenuBrowseRecords.Enabled = True
  727.     Else
  728.         MenuSearchRecords.Enabled = True
  729.         MenuBrowseRecords.Enabled = False
  730.     End If
  731.     If Label14.Caption <> "" Then
  732.         Command3D3.Enabled = True
  733.     Else
  734.         Command3D3.Enabled = False
  735.     End If
  736.     List2.Visible = True
  737.     Data1.Enabled = True
  738.     ABM = ""            'must turn off bookmark after cancel
  739. Else
  740.     MenuAddRecord_Click
  741. End If
  742. End Sub
  743.  
  744. Sub Command3D2_Click ()
  745. 'Update the added record and the name list and display
  746. 'new record in browse mode
  747.  
  748.     If Data1.EditMode = 2 Then
  749.         Label11.Caption = Date$
  750.         Data1.Recordset.Update
  751.         If Data1.EditMode = 0 Then      'record written ?
  752.             Data1.Recordset.MoveLast
  753.             CurrRec = Data1.Recordset!ID
  754.             Data1.Refresh
  755.             UpdateMyList
  756.             List2.Visible = True
  757.             Data1.Recordset.FindFirst "ID = " & CStr(CurrRec)
  758.         Else
  759.             On Local Error GoTo NoNo
  760.             Data1.Recordset.FindFirst "ID = " & CStr(CurrRec)
  761.         End If
  762.         ABM = ""    'must turn off bookmark when add finished
  763.     End If
  764.     Data1.Enabled = True
  765.     MenuAddRecord.Enabled = True
  766.     MenuDeleteRecord.Enabled = True
  767.     MenuSearchRecords.Enabled = True
  768.     Command3D2.Visible = False
  769.     Command3D1.Visible = False
  770.     Exit Sub
  771. NoNo:
  772.     If Err = 3021 Then
  773.         Resume Next
  774.     Else
  775.         Resume Next
  776.     End If
  777.  
  778. End Sub
  779.  
  780. Sub Command3D3_Click ()
  781. 'play the voice file. It error then just exit. Don't
  782. 'cause the user alot of hassle
  783.  
  784. If Label14.Caption = "" Then Exit Sub
  785. Command3D3.Enabled = False
  786. MenuVoice.Enabled = False
  787. PlayFile$ = Trim$(Label14.Caption)
  788. OpenStr$ = "open " & PlayFile$ & " alias talk"
  789. If Not MMSend%(OpenStr$) Then
  790.     Command3D3.Enabled = True       'may need to recheck label14
  791.     MenuVoice.Enabled = True
  792.     Exit Sub
  793. End If
  794. If Not MMSend%("play talk from 0") Then
  795.     X% = MMSend%("close talk")
  796.     Command3D3.Enabled = True
  797.     MenuVoice.Enabled = True
  798.     Exit Sub
  799. Else
  800.     Timer1.Enabled = True   'start timer to check when to close
  801. End If
  802. End Sub
  803.  
  804. Sub CommandOff ()
  805. For i% = 0 To 3
  806.     Command1(i%).Visible = False
  807. Next i%
  808. AlreadySet = False
  809. End Sub
  810.  
  811. Sub Data1_Error (DataErr As Integer, Response As Integer)
  812. 'Display an error if database file can't be found and exit
  813.  
  814. Select Case DataErr
  815.     Case 3004
  816.         Response = 0
  817.         Msg$ = "Couldn't Find DataBase " & DBName
  818.         Beep
  819.         MsgBox Msg$, 16, ErrorMsg
  820.         End
  821.     Case 3024
  822.         Response = 0
  823.         Msg$ = "Couldn't Find File " & DBName
  824.         Beep
  825.         MsgBox Msg$, 16, ErrorMsg
  826.         End
  827. End Select
  828. End Sub
  829.  
  830. Sub Data1_Reposition ()
  831. If SkipIt Then Exit Sub 'don't do anything
  832. Dim ds As dynaset
  833. Dim bm As String
  834.  
  835. 'update MyRec and TotRec to try and make sure we are on
  836. 'top of things. Change caption in data1 to reflect where
  837. 'we are at...hopefully
  838.  
  839. If Data1.Recordset.EOF = 0 Then
  840.     Set ds = Data1.Recordset.Clone()
  841.     bm = Data1.Recordset.Bookmark
  842.     ds.MoveFirst
  843.     MyRec = 1
  844.     While ds.Bookmark <> bm
  845.         MyRec = MyRec + 1
  846.         ds.MoveNext
  847.     Wend
  848.     ds.MoveLast
  849.     TotRec = ds.RecordCount
  850.     ds.Close
  851.     Data1.Caption = "Record " & CStr(MyRec) & " of " & CStr(TotRec)
  852. End If
  853.  
  854. 'keep the listbox index up to date if possible
  855.  
  856. If List1.ListCount <> 0 And Data1.Recordset.EOF = 0 And Data1.EditMode <> 2 Then
  857.     For i% = 0 To List1.ListCount - 1
  858.         If List1.List(i%) = CStr(Data1.Recordset!ID) Then
  859.             List1.ListIndex = i%
  860.             List2.ListIndex = i%
  861.             Exit For
  862.         End If
  863.     Next i%
  864. End If
  865.  
  866. 'keep Comman3d3 up to date as far as enabled property
  867.  
  868. If Not Timer1.Enabled Then
  869.     If Label14.Caption = "" Then
  870.         Command3D3.Enabled = False
  871.     Else
  872.         Command3D3.Enabled = True
  873.     End If
  874. End If
  875. End Sub
  876.  
  877. Sub Data1_Validate (Action As Integer, Save As Integer)
  878. 'skip update if this flag set. used by cancel button in
  879. 'add mode
  880.  
  881. If CancelFlag = True Then
  882.     CancelFlag = False
  883.     Save = False
  884.     Exit Sub
  885. End If
  886. Select Case Action
  887.     Case 6
  888.     
  889.     Case 11                         'form unload
  890.         If Save = True Then
  891.             Beep
  892.             If MsgBox("Commit Changes before Closing?", 36, "Mike's Address") <> 6 Then
  893.                 Save = False
  894.             Else
  895.                 Label11.Caption = Date$     'make sure save new date
  896.             End If
  897.         End If
  898. End Select
  899. End Sub
  900.  
  901. Sub FilterString (ts$)
  902. 'Make sure that we don't goof up SQLQ special characters
  903. 'and get them confused with our search string. The [ and
  904. '] characters are not allowed in search string.
  905.  
  906. cString$ = ""
  907. If InStr(ts$, "#") Or InStr(ts$, "*") Or InStr(ts$, "?") Then
  908.     For i% = 1 To Len(ts$)
  909.         a$ = Mid$(ts$, i%, 1)
  910.         If a$ = "#" Or a$ = "*" Or a$ = "?" Then
  911.             cString$ = cString$ & "[" & a$ & "]"
  912.         Else
  913.             cString$ = cString$ & a$
  914.         End If
  915.     Next i%
  916.     ts$ = cString$
  917. End If
  918. End Sub
  919.  
  920. Sub Form_Load ()
  921. Dim ds As dynaset
  922.  
  923. ErrorMsg = "Mike's Address Error"
  924. If App.PrevInstance Then          'load only one
  925.     Beep
  926.     MsgBox "Mike's Address Already Running.", 16, ErrorMsg
  927.     End
  928. End If
  929. ThePath = App.Path  'ThePath is Global Variable
  930. If Right$(ThePath, 1) <> "\" Then
  931.     ThePath = ThePath & "\"
  932. End If
  933. X$ = ThePath & "Address.ini"
  934. If Not INISetup%(X$) Then   'we need an ini file
  935.     Beep
  936.     MsgBox "Unable to SetUp Initialization File.", 16, ErrorMsg
  937.     End
  938. End If
  939. 'check to see if we have wave playing device. if not then
  940. 'we just turn off a button and caption so they are not
  941. 'available to the user.
  942. If Not IsWavePlay%() Then
  943.     MenuVoice.Visible = False
  944.     Command3D3.Visible = False
  945. End If
  946. 'set the window position
  947. Default$ = "NOTOP"
  948. INIFile$ = ThePath & "Address.ini"
  949. TheTop$ = GetPPKeyString$("Position", "aTop", Default$, INIFile$)
  950. TheLeft$ = GetPPKeyString$("Position", "aLeft", Default$, INIFile$)
  951. If TheTop$ = "NOTOP" Or TheLeft$ = "NOTOP" Then
  952.     Address.Top = (Screen.Height - Address.Height) \ 2
  953.     Address.Left = (Screen.Width - Address.Width) \ 2
  954. Else
  955.     Address.Top = CDbl(TheTop$)
  956.     Address.Left = CDbl(TheLeft$)
  957. End If
  958. 'open up that database
  959. DBName = ThePath & "ADDRESS.MDB"
  960. Data1.DatabaseName = DBName
  961. Data1.RecordSource = "Select * From Addresses Order by tAlpha"
  962. SkipIt = True
  963. Command3D2.Visible = False
  964. Command3D1.Visible = False
  965. Data1.Refresh
  966. Address.Show
  967. 'if database empty then go to add mode
  968. If Data1.Recordset.BOF And Data1.Recordset.EOF Then
  969.     MenuAddRecord_Click
  970. Else    'else update list box and show first record
  971.     UpdateMyList
  972.     List1.ListIndex = 0
  973.     List2.ListIndex = 0
  974.     Set ds = Data1.Recordset.Clone()
  975.     ds.MoveLast
  976.     TotRec = ds.RecordCount
  977.     ds.Close
  978.     MyRec = 1
  979.     Data1.Caption = "Record " & CStr(MyRec) & " of " & CStr(TotRec)
  980.     MenuBrowseRecords.Enabled = False
  981.     If Label14.Caption = "" Then
  982.         Command3D3.Enabled = False
  983.     End If
  984. End If
  985. SkipIt = False
  986. End Sub
  987.  
  988. Sub Form_Resize ()
  989. 'I like a border around my application and need the minimize
  990. 'button. This procedure lets me have the border and prevents
  991. 'the user from resizing the form. Note there is a flag
  992. 'to allow me to resize the form from code.
  993.  
  994. If Address.Height <> 6045 Or Address.Width <> 5295 Then
  995.     If Address.WindowState <> 1 Then
  996.         If OkSize = False Then
  997.             Address.Height = 6045
  998.             Address.Width = 5295
  999.         End If
  1000.     End If
  1001. End If
  1002. End Sub
  1003.  
  1004. Sub Form_Unload (Cancel As Integer)
  1005. 'make sure we close out the player if still running
  1006. Y% = MMSend("close talk")   'make sure we are closed
  1007. 'save form position to ini file for next start up
  1008. INIFile$ = ThePath & "Address.ini"
  1009. SetName$ = CStr(Address.Top)
  1010. Y% = WritePPKeyString%("Position", "aTop", SetName$, INIFile$)
  1011. SetName$ = CStr(Address.Left)
  1012. Y% = WritePPKeyString%("Position", "aLeft", SetName$, INIFile$)
  1013. End
  1014. End Sub
  1015.  
  1016. Sub Label14_Click ()
  1017. 'this label receives the path to the voice file
  1018. End Sub
  1019.  
  1020. Sub List2_DblClick ()
  1021. If List2.ListCount = 0 Then Exit Sub
  1022. TheID$ = List1.List(List2.ListIndex)
  1023. If Command1(0).Visible = True Then
  1024.     UpdateTheRecord
  1025. End If
  1026. Data1.Recordset.FindFirst "ID= " & TheID$
  1027. End Sub
  1028.  
  1029. Sub List2_KeyPress (KeyAscii As Integer)
  1030. If KeyAscii = 13 Then
  1031.     KeyAscii = 0
  1032.     List2_DblClick
  1033. End If
  1034. End Sub
  1035.  
  1036. Sub MenuAddRecord_Click ()
  1037. On Local Error GoTo cNewErr
  1038. If Command1(0).Visible Then
  1039.     UpdateTheRecord
  1040. End If
  1041. ABM = ""
  1042. 'save the following values for future use
  1043. CurrRec = Data1.Recordset!ID
  1044. ABM = Data1.Recordset.Bookmark
  1045. Data1.Recordset.AddNew
  1046. Data1.Caption = "New Record"
  1047. List2.Visible = False
  1048. Data1.Enabled = False
  1049. MenuAddRecord.Enabled = False
  1050. MenuDeleteRecord.Enabled = False
  1051. MenuBrowseRecords.Enabled = False
  1052. MenuSearchRecords.Enabled = False
  1053. Command3D2.Visible = True
  1054. Command3D1.Visible = True
  1055. Command3D3.Enabled = False
  1056. Text1.SetFocus
  1057. Exit Sub
  1058. cNewErr:
  1059.     'If Err = 3021 Then
  1060.      '   CurrRec = -1
  1061.         Resume Next
  1062.     'Else
  1063.         'Resume cnewEnd
  1064.     'End If
  1065. cnewEnd:
  1066.  
  1067. End Sub
  1068.  
  1069. Sub MenuBrowseRecords_Click ()
  1070. Dim ds As dynaset
  1071. 'save records if something has changed only if command1
  1072. 'is visible
  1073. If Command1(0).Visible Then
  1074.     UpdateTheRecord
  1075. End If
  1076. SkipIt = True
  1077. SearchFlag = False
  1078. MenuSearchRecords.Enabled = True
  1079. MenuBrowseRecords.Enabled = False
  1080. 'reset the recordsource and refresh to original recordset
  1081. Data1.RecordSource = "Select * From Addresses Order by tAlpha"
  1082. Data1.Refresh
  1083. 'if empty then go to add mode
  1084. If Data1.Recordset.BOF And Data1.Recordset.EOF Then
  1085.     Beep
  1086.     MsgBox "No Records to Browse. Going to Add Mode.", 16, ErrorMsg
  1087.     MenuAddRecord_Click
  1088. Else
  1089.     UpdateMyList
  1090.     List1.ListIndex = 0
  1091.     List2.ListIndex = 0
  1092.     Set ds = Data1.Recordset.Clone()
  1093.     ds.MoveLast
  1094.     TotRec = ds.RecordCount
  1095.     ds.Close
  1096.     MyRec = 1
  1097.     Data1.Caption = "Record " & CStr(MyRec) & " of " & CStr(TotRec)
  1098.     If Label14.Caption <> "" Then
  1099.         Command3D3.Enabled = True
  1100.     Else
  1101.         Command3D3.Enabled = False
  1102.     End If
  1103. End If
  1104. SkipIt = False
  1105. End Sub
  1106.  
  1107. Sub MenuClear_Click ()
  1108. 'delete some text and set for update
  1109. Screen.ActiveControl.SelText = ""
  1110. SetUpdate
  1111. End Sub
  1112.  
  1113. Sub MenuCompact_Click ()
  1114. Dim ds As dynaset
  1115. 'we can change the form size by setting the oksize flag
  1116. 'we do this so someone doesn't start click controls on
  1117. 'the main form while we are compacting
  1118. OkSize = True
  1119. Address.Height = 200
  1120. Standby.Show
  1121. Standby.Refresh
  1122. Data1.Database.Close    'VERY IMPORTANT
  1123. cSource$ = ThePath & "Address.mdb"
  1124. cDest$ = ThePath & "NAddress.mdb"
  1125. On Error Resume Next
  1126. CompactDatabase cSource$, cDest$
  1127. If Err Then
  1128.     Beep
  1129.     MsgBox "Unable to Compact DataBase.", 16, ErrorMsg
  1130.     On Error GoTo 0
  1131.     GoTo cReload
  1132. End If
  1133. On Error GoTo 0
  1134. Kill cSource$
  1135. Name cDest$ As cSource$
  1136. cReload:
  1137. 'reload the database
  1138. Data1.DatabaseName = DBName
  1139. Data1.RecordSource = "Select * From Addresses Order by tAlpha"
  1140. SkipIt = True
  1141. Command3D2.Visible = False
  1142. Command3D1.Visible = False
  1143. Data1.Refresh
  1144. If Data1.Recordset.BOF And Data1.Recordset.EOF Then
  1145.     MenuAddRecord_Click
  1146. Else
  1147.     UpdateMyList
  1148.     List1.ListIndex = 0
  1149.     List2.ListIndex = 0
  1150.     Set ds = Data1.Recordset.Clone()
  1151.     ds.MoveLast
  1152.     TotRec = ds.RecordCount
  1153.     ds.Close
  1154.     MyRec = 1
  1155.     Data1.Caption = "Record " & CStr(MyRec) & " of " & CStr(TotRec)
  1156.     MenuBrowseRecords.Enabled = False
  1157.     If Label14.Caption = "" Then
  1158.         Command3D3.Enabled = False
  1159.     End If
  1160. End If
  1161. SkipIt = False
  1162. 'resize form back and keep the user out of it
  1163. OkSize = False
  1164. Address.Height = 6045
  1165. Unload Standby
  1166. End Sub
  1167.  
  1168. Sub MenuCopy_Click ()
  1169. Clipboard.Clear
  1170. Clipboard.SetText Screen.ActiveControl.SelText
  1171. End Sub
  1172.  
  1173. Sub MenuCopyAddress_Click ()
  1174. TheString$ = ""
  1175. TheString$ = Trim$(Text1.Text) & Chr$(13) & Chr$(10)
  1176. If Trim$(Text2.Text) <> "" Then
  1177.     TheString$ = TheString$ & Trim$(Text2.Text) & Chr$(13) & Chr$(10)
  1178. End If
  1179. If Trim$(Text3.Text) <> "" Then
  1180.     TheString$ = TheString$ & Trim$(Text3.Text) & Chr$(13) & Chr$(10)
  1181. End If
  1182. If Trim$(Text4.Text) <> "" Then
  1183.     TheString$ = TheString$ & Trim$(Text4.Text) & ", " & Trim$(Text5.Text)
  1184.     TheString$ = TheString$ & " " & Trim$(Text6.Text) & " " & Trim$(Text10.Text) & Chr$(13) & Chr$(10)
  1185. End If
  1186. If Trim$(Text7.Text) <> "" Then
  1187.     TheString$ = TheString$ & Trim$(Text7.Text) & Chr$(13) & Chr$(10)
  1188. End If
  1189. Clipboard.Clear
  1190. Clipboard.SetText TheString$
  1191. End Sub
  1192.  
  1193. Sub MenuCut_Click ()
  1194. MenuCopy_Click
  1195. Screen.ActiveControl.SelText = ""
  1196. SetUpdate
  1197. End Sub
  1198.  
  1199. Sub MenuDeleteRecord_Click ()
  1200. CommandOff
  1201. For i% = 0 To List1.ListCount - 1    'Make sure index set right
  1202.     If List1.List(i%) = CStr(Data1.Recordset!ID) Then
  1203.         List1.ListIndex = i%
  1204.         List2.ListIndex = i%
  1205.         Exit For
  1206.      End If
  1207. Next i%
  1208. List1.RemoveItem List1.ListIndex
  1209. List2.RemoveItem List2.ListIndex
  1210. xx$ = Label14.Caption
  1211. On Error Resume Next
  1212. Kill xx$
  1213. Data1.Recordset.Delete
  1214. Data1.Recordset.MoveNext
  1215. If Data1.Recordset.EOF Then
  1216.     On Local Error GoTo cDelErr 'this required if last record deleted
  1217.     Data1.Recordset.MovePrevious
  1218. End If
  1219. Exit Sub
  1220. cDelErr:
  1221.     If Err = 3021 Then
  1222.         If SearchFlag = False Then
  1223.             Beep
  1224.             MsgBox "Last Recorded in Database Deleted.", 16, ErrorMsg
  1225.             MenuAddRecord_Click
  1226.             Resume cDelEnd
  1227.         Else
  1228.             Beep
  1229.             MsgBox "Last Record in Search Deleted. Returning to Browse Mode.", 16, ErrorMsg
  1230.             MenuBrowseRecords_Click
  1231.             Resume cDelEnd
  1232.         End If
  1233.     Else
  1234.         Resume cDelEnd
  1235.     End If
  1236. cDelEnd:
  1237. End Sub
  1238.  
  1239. Sub MenuDeleteVoice_Click ()
  1240. 'obvious
  1241. X$ = Label14.Caption
  1242. Label14.Caption = ""
  1243. Command3D3.Enabled = False
  1244. On Error Resume Next
  1245. Kill X$
  1246. On Error GoTo 0
  1247. End Sub
  1248.  
  1249. Sub MenuDial_Click ()
  1250. 'check the port form ini file. note if user has not used
  1251. 'setup at least once he or she will be told to
  1252. Default$ = "NOPORT"
  1253. INIFile$ = ThePath & "ADDRESS.INI"
  1254. TC$ = GetPPKeyString$("Phone", "Port", Default$, INIFile$)
  1255. If TC$ = "NOPORT" Then
  1256.     Beep
  1257.     MsgBox "You Must SetUp a Comm Port.", 16, ErrorMsg
  1258.     Exit Sub
  1259. End If
  1260. TheComm = CInt(TC$) 'thecomm is a global variable
  1261. 'check callstring for bad characters
  1262. CheckString$ = "1234567890()-,"
  1263. BadNum% = False
  1264. For i% = 1 To Len(CallString)
  1265.     a$ = Mid$(CallString, i%, 1)
  1266.     If InStr(CheckString$, a$) = 0 Then
  1267.         Beep
  1268.         MsgBox "Selected Number is Incorrect.", 16, ErrorMsg
  1269.         BadNum% = True
  1270.         Exit For
  1271.     End If
  1272. Next i%
  1273. If BadNum% Then Exit Sub
  1274. Dial.Text1.Text = CallString
  1275. Dial.Show 1
  1276. End Sub
  1277.  
  1278. Sub MenuEdit_Click ()
  1279. 'make sure only the right menu items are enabled
  1280. MenuCut.Enabled = True
  1281. MenuCopy.Enabled = True
  1282. MenuPaste.Enabled = False
  1283. MenuClear.Enabled = True
  1284. MenuCopyAddress.Enabled = True
  1285. If TypeOf Screen.ActiveControl Is TextBox Then
  1286.     If Clipboard.GetFormat(1) Then MenuPaste.Enabled = True
  1287.     If Screen.ActiveControl.SelText = "" Then
  1288.         MenuCut.Enabled = False
  1289.         MenuCopy.Enabled = False
  1290.         MenuClear.Enabled = False
  1291.     End If
  1292. Else
  1293.     MenuCut.Enabled = False
  1294.     MenuCopy.Enabled = False
  1295.     MenuClear.Enabled = False
  1296. End If
  1297. End Sub
  1298.  
  1299. Sub MenuExit_Click ()
  1300. Unload Address
  1301. End Sub
  1302.  
  1303. Sub MenuNameList_Click ()
  1304. Dim ds As dynaset
  1305. PrintX.Show
  1306. Set ds = Data1.Recordset.Clone()
  1307. MaxRows% = Int(Printer.Height / Printer.TextHeight("T"))
  1308. MaxRows% = MaxRows% - 5
  1309. Printer.Print "Mike's Address Name List"
  1310. Printer.Print String$(35, "=")
  1311. PrintedRows% = 0
  1312. Do While Not ds.EOF
  1313.     If IsNull(ds("tName")) Then 'watch out for
  1314.         Printer.Print "XXXXXX"  'and substitute
  1315.     Else
  1316.         Printer.Print ds("tName")
  1317.     End If
  1318.     DoEvents
  1319.     If PrintCancel Then Exit Do
  1320.     PrintedRows% = PrintedRows% + 1
  1321.     If PrintedRows% = MaxRows% Then
  1322.         Printer.NewPage
  1323.         Printer.Print "Mike's Address Name List"
  1324.         Printer.Print String$(35, "=")
  1325.         PrintedRows% = 0
  1326.     End If
  1327.     ds.MoveNext
  1328. Loop
  1329. Printer.EndDoc
  1330. ds.Close
  1331. Unload PrintX
  1332. End Sub
  1333.  
  1334. Sub MenuOneList_Click ()
  1335. Dim ds As dynaset
  1336. PrintX.Show
  1337. Set ds = Data1.Recordset.Clone()
  1338. MaxRows% = Int(Printer.Height / Printer.TextHeight("T"))
  1339. MaxRows% = MaxRows% - 5
  1340. Printer.Print "Mike's Address Name & Phone List"
  1341. Printer.Print String$(75, "=")
  1342. PrintedRows% = 0
  1343. Do While Not ds.EOF
  1344.     If IsNull(ds("tName")) Then
  1345.         Printer.Print "XXXXXX"; String$(40 - 6, ".");
  1346.     Else
  1347.         Printer.Print ds("tName"); String$(40 - Len(ds("tName")), ".");
  1348.     End If
  1349.     
  1350.     If IsNull(ds("tPhone")) Then
  1351.         Printer.Print " "
  1352.     Else
  1353.         Printer.Print (ds("tPhone"))
  1354.     End If
  1355.     DoEvents
  1356.     If PrintCancel Then Exit Do
  1357.     PrintedRows% = PrintedRows% + 1
  1358.     If PrintedRows% = MaxRows% Then
  1359.         Printer.NewPage
  1360.         Printer.Print "Mike's Address Name & Phone List"
  1361.         Printer.Print String$(75, "=")
  1362.         PrintedRows% = 0
  1363.     End If
  1364.     ds.MoveNext
  1365. Loop
  1366. Printer.EndDoc
  1367. ds.Close
  1368. Unload PrintX
  1369. End Sub
  1370.  
  1371. Sub MenuPaste_Click ()
  1372. Screen.ActiveControl.SelText = Clipboard.GetText()
  1373. SetUpdate
  1374. End Sub
  1375.  
  1376. Sub MenuPhone_Click ()
  1377. MenuDial.Enabled = False
  1378. 'make sure we have a good callstring selected before we
  1379. 'allow a call to be dialed
  1380. If TypeOf Screen.ActiveControl Is TextBox Then
  1381.     If Trim$(Screen.ActiveControl.SelText) <> "" Then
  1382.         CallString = Screen.ActiveControl.SelText
  1383.         CallString = Trim$(CallString)
  1384.         MenuDial.Enabled = True
  1385.     End If
  1386. End If
  1387. End Sub
  1388.  
  1389. Sub MenuRecordVoice_Click ()
  1390. RecordIt.Show 1
  1391. If RecordIt.Tag = "NO" Then
  1392.     Beep
  1393.     MsgBox "Unable to Complete Recording.", 16, ErrorMsg
  1394. End If
  1395. If Label14.Caption <> "" Then
  1396.     Command3D3.Enabled = True
  1397. Else
  1398.     Command3D3.Enabled = False
  1399. End If
  1400. Unload RecordIt
  1401. End Sub
  1402.  
  1403. Sub MenuSearchRecords_Click ()
  1404. Dim ds As dynaset
  1405.  
  1406. If Command1(0).Visible Then
  1407.     UpdateTheRecord
  1408. End If
  1409. CommandOff
  1410. CurrRec = Data1.Recordset!ID
  1411. Search.Show 1
  1412. 'this is one heck of a way to do things
  1413. If Search.Tag = "YES" Then
  1414.     ThePattern$ = Trim$(Search.Text1.Text)
  1415.     FilterString ThePattern$
  1416.     ThePattern$ = " '*" & ThePattern$ & "*' OR "
  1417.     SQLQ$ = "SELECT * FROM Addresses WHERE "
  1418.     cFilter$ = ""
  1419.     If Search.Check3D1.Value Then
  1420.         cFilter$ = cFilter$ & "tName LIKE" & ThePattern$
  1421.     End If
  1422.     If Search.Check3D2.Value Then
  1423.         cFilter$ = cFilter$ & "tStreet1 LIKE" & ThePattern$ & "tStreet2 LIKE" & ThePattern$
  1424.     End If
  1425.     If Search.Check3D3.Value Then
  1426.         cFilter$ = cFilter$ & "tCity LIKE" & ThePattern$
  1427.     End If
  1428.     If Search.Check3D4.Value Then
  1429.         cFilter$ = cFilter$ & "tState LIKE" & ThePattern$
  1430.     End If
  1431.     If Search.Check3D5.Value Then
  1432.         cFilter$ = cFilter$ & "tZip LIKE" & ThePattern$
  1433.     End If
  1434.     If Search.Check3D6.Value Then
  1435.         cFilter$ = cFilter$ & "tRegion LIKE" & ThePattern$
  1436.     End If
  1437.     If Search.Check3D7.Value Then
  1438.         cFilter$ = cFilter$ & "tMessage LIKE" & ThePattern$
  1439.     End If
  1440.     If Search.Check3D8.Value Then
  1441.         cFilter$ = cFilter$ & "tInfo LIKE" & ThePattern$
  1442.     End If
  1443.     If Search.Check3D9.Value Then
  1444.         cFilter$ = cFilter$ & "tPhone LIKE" & ThePattern$
  1445.     End If
  1446.     cFilter$ = Left$(cFilter$, Len(cFilter$) - 3)
  1447.     SQLQ$ = SQLQ$ & cFilter$ & " ORDER BY tAlpha"
  1448.     Data1.RecordSource = SQLQ$
  1449.     SkipIt = True
  1450.     Data1.Refresh
  1451.     If Data1.Recordset.BOF And Data1.Recordset.EOF Then
  1452.         Beep
  1453.         Msg$ = "Search String " & Search.Text1.Text & " Not Found."
  1454.         MsgBox Msg$, 16, ErrorMsg
  1455.         Data1.RecordSource = "Select * From Addresses Order by tAlpha"
  1456.         Data1.Refresh
  1457.         UpdateMyList
  1458.         SkipIt = False
  1459.         Data1.Recordset.FindFirst "ID = " & CStr(CurrRec)
  1460.         If Label14.Caption <> "" Then
  1461.             Command3D3.Enabled = True
  1462.         Else
  1463.             Command3D3.Enabled = False
  1464.         End If
  1465.     Else
  1466.         SearchFlag = True
  1467.         MenuSearchRecords.Enabled = False
  1468.         MenuBrowseRecords.Enabled = True
  1469.         UpdateMyList
  1470.         List1.ListIndex = 0
  1471.         List2.ListIndex = 0
  1472.         Set ds = Data1.Recordset.Clone()
  1473.         ds.MoveLast
  1474.         TotRec = ds.RecordCount
  1475.         ds.Close
  1476.         MyRec = 1
  1477.         Data1.Caption = "Record " & CStr(MyRec) & " of " & CStr(TotRec)
  1478.         If Label14.Caption <> "" Then
  1479.             Command3D3.Enabled = True
  1480.         Else
  1481.             Command3D3.Enabled = False
  1482.         End If
  1483.         SkipIt = False
  1484.     End If
  1485. Else
  1486.     If Search.Tag = "NO" Then
  1487.         Beep
  1488.         MsgBox "Illegal Search Criteria !!!", 16, ErrorMsg
  1489.     End If
  1490. End If
  1491. Unload Search
  1492. End Sub
  1493.  
  1494. Sub MenuSetup_Click ()
  1495. Setup.Show 1
  1496. End Sub
  1497.  
  1498. Sub MenuTwoList_Click ()
  1499. Dim ds As dynaset
  1500. PrintX.Show
  1501. Set ds = Data1.Recordset.Clone()
  1502. MaxRows% = Int(Printer.Height / Printer.TextHeight("T"))
  1503. MaxRows% = (MaxRows% - 5) \ 3
  1504. Printer.Print "Mike's Address Name & Phone List"
  1505. Printer.Print String$(35, "=")
  1506. PrintedRows% = 0
  1507. Do While Not ds.EOF
  1508.     If IsNull(ds("tName")) Then
  1509.         Printer.Print "XXXXXX"
  1510.     Else
  1511.         Printer.Print ds("tName")
  1512.     End If
  1513.     If IsNull(ds("tPhone")) Then
  1514.         Printer.Print " "
  1515.     Else
  1516.         Printer.Print ds("tPhone")
  1517.     End If
  1518.     Printer.Print String$(35, "_")
  1519.     DoEvents
  1520.     If PrintCancel Then Exit Do
  1521.     PrintedRows% = PrintedRows% + 1
  1522.     If PrintedRows% = MaxRows% Then
  1523.         Printer.NewPage
  1524.         Printer.Print "Mike's Address Name & Phone List"
  1525.         Printer.Print String$(35, "=")
  1526.         PrintedRows% = 0
  1527.     End If
  1528.     ds.MoveNext
  1529. Loop
  1530. Printer.EndDoc
  1531. ds.Close
  1532. Unload PrintX
  1533. End Sub
  1534.  
  1535. Sub MenuVoice_Click ()
  1536. 'delete only available if label14 has caption
  1537. If Label14.Caption = "" Then
  1538.     MenuDeleteVoice.Enabled = False
  1539. Else
  1540.     MenuDeleteVoice.Enabled = True
  1541. End If
  1542. End Sub
  1543.  
  1544. Sub SetUpdate ()
  1545. 'If someone has changed something then use our buttons
  1546. 'and not the data control's. This assures that we keep
  1547. 'the database in correct order.
  1548.  
  1549. If Data1.EditMode = 2 Then Exit Sub
  1550. If AlreadySet Then Exit Sub
  1551. For i% = 0 To 3
  1552.     Command1(i%).Visible = True
  1553. Next i%
  1554. Data1.Enabled = False
  1555. AlreadySet = True
  1556. End Sub
  1557.  
  1558. Sub Text1_KeyDown (KeyCode As Integer, Shift As Integer)
  1559. 'need to set update if char deleted
  1560. If KeyCode = 46 Then    'delete key hit
  1561.     SetUpdate
  1562. End If
  1563. End Sub
  1564.  
  1565. Sub Text1_KeyPress (KeyAscii As Integer)
  1566. 'cr=tab
  1567. If KeyAscii = 13 Then
  1568.     KeyAscii = 0
  1569.     SendKeys "{TAB}"
  1570.     Exit Sub
  1571. End If
  1572. 'set for update something has changed
  1573. SetUpdate
  1574. End Sub
  1575.  
  1576. Sub Text10_KeyDown (KeyCode As Integer, Shift As Integer)
  1577. If KeyCode = 46 Then    'delete key hit
  1578.     SetUpdate
  1579. End If
  1580.  
  1581. End Sub
  1582.  
  1583. Sub Text10_KeyPress (KeyAscii As Integer)
  1584. If KeyAscii = 13 Then
  1585.     KeyAscii = 0
  1586.     SendKeys "{TAB}"
  1587.     Exit Sub
  1588. End If
  1589. SetUpdate
  1590. End Sub
  1591.  
  1592. Sub Text11_KeyDown (KeyCode As Integer, Shift As Integer)
  1593. If KeyCode = 46 Then    'delete key hit
  1594.     SetUpdate
  1595. End If
  1596.  
  1597. End Sub
  1598.  
  1599. Sub Text11_KeyPress (KeyAscii As Integer)
  1600. If KeyAscii = 13 Then
  1601.     KeyAscii = 0
  1602.     SendKeys "{TAB}"
  1603.     Exit Sub
  1604. End If
  1605. SetUpdate
  1606. End Sub
  1607.  
  1608. Sub Text2_KeyDown (KeyCode As Integer, Shift As Integer)
  1609. If KeyCode = 46 Then    'delete key hit
  1610.     SetUpdate
  1611. End If
  1612.  
  1613. End Sub
  1614.  
  1615. Sub Text2_KeyPress (KeyAscii As Integer)
  1616. If KeyAscii = 13 Then
  1617.     KeyAscii = 0
  1618.     SendKeys "{TAB}"
  1619.     Exit Sub
  1620. End If
  1621. SetUpdate
  1622. End Sub
  1623.  
  1624. Sub Text3_KeyDown (KeyCode As Integer, Shift As Integer)
  1625. If KeyCode = 46 Then    'delete key hit
  1626.     SetUpdate
  1627. End If
  1628.  
  1629. End Sub
  1630.  
  1631. Sub Text3_KeyPress (KeyAscii As Integer)
  1632. If KeyAscii = 13 Then
  1633.     KeyAscii = 0
  1634.     SendKeys "{TAB}"
  1635.     Exit Sub
  1636. End If
  1637. SetUpdate
  1638. End Sub
  1639.  
  1640. Sub Text4_KeyDown (KeyCode As Integer, Shift As Integer)
  1641. If KeyCode = 46 Then    'delete key hit
  1642.     SetUpdate
  1643. End If
  1644.  
  1645. End Sub
  1646.  
  1647. Sub Text4_KeyPress (KeyAscii As Integer)
  1648. If KeyAscii = 13 Then
  1649.     KeyAscii = 0
  1650.     SendKeys "{TAB}"
  1651.     Exit Sub
  1652. End If
  1653. SetUpdate
  1654. End Sub
  1655.  
  1656. Sub Text5_KeyDown (KeyCode As Integer, Shift As Integer)
  1657. If KeyCode = 46 Then    'delete key hit
  1658.     SetUpdate
  1659. End If
  1660.  
  1661. End Sub
  1662.  
  1663. Sub Text5_KeyPress (KeyAscii As Integer)
  1664. If KeyAscii = 13 Then
  1665.     KeyAscii = 0
  1666.     SendKeys "{TAB}"
  1667.     Exit Sub
  1668. End If
  1669. SetUpdate
  1670. End Sub
  1671.  
  1672. Sub Text6_KeyDown (KeyCode As Integer, Shift As Integer)
  1673. If KeyCode = 46 Then    'delete key hit
  1674.     SetUpdate
  1675. End If
  1676.  
  1677. End Sub
  1678.  
  1679. Sub Text6_KeyPress (KeyAscii As Integer)
  1680. If KeyAscii = 13 Then
  1681.     KeyAscii = 0
  1682.     SendKeys "{TAB}"
  1683.     Exit Sub
  1684. End If
  1685. SetUpdate
  1686. End Sub
  1687.  
  1688. Sub Text7_KeyDown (KeyCode As Integer, Shift As Integer)
  1689. If KeyCode = 46 Then    'delete key hit
  1690.     SetUpdate
  1691. End If
  1692.  
  1693. End Sub
  1694.  
  1695. Sub Text7_KeyPress (KeyAscii As Integer)
  1696. If KeyAscii = 13 Then
  1697.     KeyAscii = 0
  1698.     SendKeys "{TAB}"
  1699.     Exit Sub
  1700. End If
  1701. SetUpdate
  1702. End Sub
  1703.  
  1704. Sub Text8_KeyDown (KeyCode As Integer, Shift As Integer)
  1705. If KeyCode = 46 Then    'delete key hit
  1706.     SetUpdate
  1707. End If
  1708.  
  1709. End Sub
  1710.  
  1711. Sub Text8_KeyPress (KeyAscii As Integer)
  1712. If KeyAscii = 13 Then
  1713.     KeyAscii = 0
  1714.     SendKeys "{TAB}"
  1715.     Exit Sub
  1716. End If
  1717. SetUpdate
  1718. End Sub
  1719.  
  1720. Sub Text9_KeyDown (KeyCode As Integer, Shift As Integer)
  1721. If KeyCode = 46 Then    'delete key hit
  1722.     SetUpdate
  1723. End If
  1724.  
  1725. End Sub
  1726.  
  1727. Sub Text9_KeyPress (KeyAscii As Integer)
  1728. If KeyAscii = 13 Then
  1729.     KeyAscii = 0
  1730.     SendKeys "{TAB}"
  1731.     Exit Sub
  1732. End If
  1733. SetUpdate
  1734. End Sub
  1735.  
  1736. Sub Timer1_Timer ()
  1737. 'if voice file is playing then keep checking. when done
  1738. 'then close things out and turn the timer off
  1739. Stat$ = "status talk mode"
  1740. Mlen% = 255
  1741. Msg$ = String$(255, 0)
  1742. Ret& = mciSendString(Stat$, Msg$, Mlen%, Address.hWnd)
  1743. If InStr(Msg$, "playing") = 0 Then
  1744.     X% = MMSend%("close talk")
  1745.     If Label14.Caption <> "" Then
  1746.         Command3D3.Enabled = True
  1747.     End If
  1748.     MenuVoice.Enabled = True
  1749.     Timer1.Enabled = False
  1750. End If
  1751. End Sub
  1752.  
  1753. Sub UpdateMyList ()
  1754. 'Lets refresh the list box. Note we must watch out for
  1755. 'records with NUL tName field and substitute xxxxxx.
  1756.  
  1757. Dim ds As dynaset
  1758. List1.Clear
  1759. List2.Clear
  1760. Set ds = Data1.Recordset.Clone()
  1761. 'ds.MoveFirst 'not needed problem with one record left
  1762. Do While Not ds.EOF
  1763.     List1.AddItem CStr(ds("ID"))
  1764.     If IsNull(ds("tName")) Then
  1765.         List2.AddItem "XXXXXX"
  1766.     Else
  1767.         List2.AddItem ds("tName")
  1768.     End If
  1769.     ds.MoveNext
  1770. Loop
  1771. ds.Close
  1772. End Sub
  1773.  
  1774. Sub UpdateTheRecord ()
  1775. 'We update the record and refresh data1 to bring back
  1776. 'the order we want. Note that we try to come back to the
  1777. 'record we had before refresh. Also we update the date
  1778. 'for the record here.
  1779.  
  1780. Label11.Caption = Date$
  1781. Data1.Recordset.Update
  1782. If Data1.EditMode = 0 Then
  1783.     CurrRec = Data1.Recordset!ID
  1784.     Data1.Refresh
  1785.     UpdateMyList
  1786.     Data1.Recordset.FindFirst "ID =" & CStr(CurrRec)
  1787. Else
  1788.     Data1.UpdateControls
  1789. End If
  1790. CommandOff
  1791. Data1.Enabled = True
  1792. End Sub
  1793.  
  1794.