home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap34 / contacts.frm (.txt) < prev    next >
Visual Basic Form  |  1995-09-12  |  21KB  |  654 lines

  1. VERSION 4.00
  2. Begin VB.Form frmContacts 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Contact Manager"
  5.    ClientHeight    =   4605
  6.    ClientLeft      =   1800
  7.    ClientTop       =   1785
  8.    ClientWidth     =   7275
  9.    BeginProperty Font 
  10.       name            =   "MS Sans Serif"
  11.       charset         =   0
  12.       weight          =   700
  13.       size            =   8.25
  14.       underline       =   0   'False
  15.       italic          =   0   'False
  16.       strikethrough   =   0   'False
  17.    EndProperty
  18.    Height          =   5295
  19.    Icon            =   "frmContacts.frx":0000
  20.    Left            =   1740
  21.    LinkTopic       =   "Form1"
  22.    ScaleHeight     =   4605
  23.    ScaleWidth      =   7275
  24.    Top             =   1155
  25.    Width           =   7395
  26.    Begin VB.CommandButton cmdReport 
  27.       Caption         =   "&Report"
  28.       Height          =   375
  29.       HelpContextID   =   13
  30.       Left            =   6120
  31.       TabIndex        =   13
  32.       Top             =   3480
  33.       Width           =   855
  34.    End
  35.    Begin VB.CommandButton cmdCancel 
  36.       Caption         =   "&Cancel"
  37.       Enabled         =   0   'False
  38.       Height          =   375
  39.       HelpContextID   =   10
  40.       Left            =   6120
  41.       TabIndex        =   10
  42.       Top             =   1680
  43.       Width           =   855
  44.    End
  45.    Begin VB.CommandButton cmdDelete 
  46.       Caption         =   "&Delete"
  47.       Height          =   375
  48.       HelpContextID   =   11
  49.       Left            =   6120
  50.       TabIndex        =   11
  51.       Top             =   2280
  52.       Width           =   855
  53.    End
  54.    Begin VB.CommandButton cmdAdd 
  55.       Caption         =   "&Add "
  56.       Height          =   375
  57.       HelpContextID   =   8
  58.       Left            =   6120
  59.       TabIndex        =   8
  60.       Top             =   480
  61.       Width           =   855
  62.    End
  63.    Begin VB.CommandButton cmdSave 
  64.       Caption         =   "&Save"
  65.       Enabled         =   0   'False
  66.       Height          =   375
  67.       HelpContextID   =   9
  68.       Left            =   6120
  69.       TabIndex        =   9
  70.       Top             =   1080
  71.       Width           =   855
  72.    End
  73.    Begin VB.CommandButton cmdQuery 
  74.       Caption         =   "&Query"
  75.       Height          =   375
  76.       HelpContextID   =   12
  77.       Left            =   6120
  78.       TabIndex        =   12
  79.       Top             =   3000
  80.       Width           =   855
  81.    End
  82.    Begin VB.Frame Frame2 
  83.       BackColor       =   &H000080FF&
  84.       Caption         =   "Company Information"
  85.       Height          =   1695
  86.       HelpContextID   =   6
  87.       Left            =   360
  88.       TabIndex        =   16
  89.       Top             =   960
  90.       Width           =   5535
  91.       Begin VB.TextBox txtZip 
  92.          BackColor       =   &H00FFFFFF&
  93.          DataField       =   "Zip"
  94.          DataSource      =   "dtaContacts"
  95.          ForeColor       =   &H00000000&
  96.          Height          =   285
  97.          Left            =   3960
  98.          TabIndex        =   5
  99.          Text            =   "txtZip"
  100.          Top             =   1200
  101.          Width           =   1455
  102.       End
  103.       Begin VB.TextBox txtState 
  104.          BackColor       =   &H00FFFFFF&
  105.          DataField       =   "State"
  106.          DataSource      =   "dtaContacts"
  107.          ForeColor       =   &H00000000&
  108.          Height          =   285
  109.          Left            =   3360
  110.          TabIndex        =   4
  111.          Text            =   "txtState"
  112.          Top             =   1200
  113.          Width           =   495
  114.       End
  115.       Begin VB.TextBox txtCity 
  116.          BackColor       =   &H00FFFFFF&
  117.          DataField       =   "City"
  118.          DataSource      =   "dtaContacts"
  119.          ForeColor       =   &H00000000&
  120.          Height          =   285
  121.          Left            =   480
  122.          TabIndex        =   3
  123.          Text            =   "txtCity"
  124.          Top             =   1200
  125.          Width           =   2775
  126.       End
  127.       Begin VB.TextBox txtAddress 
  128.          BackColor       =   &H00FFFFFF&
  129.          DataField       =   "Address"
  130.          DataSource      =   "dtaContacts"
  131.          ForeColor       =   &H00000000&
  132.          Height          =   285
  133.          Left            =   480
  134.          TabIndex        =   2
  135.          Text            =   "txtAddress"
  136.          Top             =   840
  137.          Width           =   4935
  138.       End
  139.       Begin VB.TextBox txtName 
  140.          BackColor       =   &H00FFFFFF&
  141.          DataField       =   "Company"
  142.          DataSource      =   "dtaContacts"
  143.          ForeColor       =   &H00000000&
  144.          Height          =   285
  145.          Left            =   480
  146.          TabIndex        =   1
  147.          Text            =   "txtCompany"
  148.          Top             =   480
  149.          Width           =   4935
  150.       End
  151.    End
  152.    Begin VB.Frame Frame1 
  153.       BackColor       =   &H00C0C0C0&
  154.       Caption         =   "Contact"
  155.       Height          =   975
  156.       HelpContextID   =   7
  157.       Left            =   360
  158.       TabIndex        =   14
  159.       Top             =   2880
  160.       Width           =   5535
  161.       Begin VB.PictureBox picPhone 
  162.          Appearance      =   0  'Flat
  163.          BackColor       =   &H00C0C0C0&
  164.          BorderStyle     =   0  'None
  165.          ForeColor       =   &H80000008&
  166.          Height          =   495
  167.          Left            =   240
  168.          Picture         =   "frmContacts.frx":030A
  169.          ScaleHeight     =   495
  170.          ScaleWidth      =   495
  171.          TabIndex        =   18
  172.          Top             =   240
  173.          Width           =   495
  174.       End
  175.       Begin VB.TextBox Text8 
  176.          BackColor       =   &H00FFFFFF&
  177.          DataField       =   "Phone"
  178.          DataSource      =   "dtaContacts"
  179.          Height          =   285
  180.          Left            =   960
  181.          TabIndex        =   7
  182.          Text            =   "txtPhone"
  183.          Top             =   600
  184.          Width           =   4455
  185.       End
  186.       Begin VB.TextBox txtContact 
  187.          BackColor       =   &H00FFFFFF&
  188.          DataField       =   "Contact"
  189.          DataSource      =   "dtaContacts"
  190.          Height          =   285
  191.          Left            =   960
  192.          TabIndex        =   6
  193.          Text            =   "txtContact"
  194.          Top             =   240
  195.          Width           =   4455
  196.       End
  197.       Begin VB.Label lblPhone 
  198.          Appearance      =   0  'Flat
  199.          AutoSize        =   -1  'True
  200.          BackColor       =   &H00C0FFFF&
  201.          BorderStyle     =   1  'Fixed Single
  202.          Caption         =   "AutoDial"
  203.          ForeColor       =   &H80000008&
  204.          Height          =   255
  205.          Left            =   120
  206.          TabIndex        =   20
  207.          Top             =   720
  208.          Visible         =   0   'False
  209.          Width           =   795
  210.       End
  211.    End
  212.    Begin VB.Data dtaContacts 
  213.       Align           =   2  'Align Bottom
  214.       Caption         =   "Contact Browser"
  215.       Connect         =   ""
  216.       DatabaseName    =   "C:\VB40\SAMS\Contacts.mdb"
  217.       Exclusive       =   0   'False
  218.       Height          =   300
  219.       Left            =   0
  220.       Options         =   0
  221.       ReadOnly        =   0   'False
  222.       RecordsetType   =   1  'Dynaset
  223.       RecordSource    =   "Contacts"
  224.       Top             =   4305
  225.       Width           =   7275
  226.    End
  227.    Begin VB.Frame Frame3 
  228.       BackColor       =   &H00C0C0C0&
  229.       Caption         =   "Code"
  230.       Height          =   615
  231.       Left            =   360
  232.       TabIndex        =   17
  233.       Top             =   240
  234.       Width           =   1335
  235.       Begin VB.TextBox txtCode 
  236.          BackColor       =   &H00FF0000&
  237.          BorderStyle     =   0  'None
  238.          DataField       =   "Code"
  239.          DataSource      =   "dtaContacts"
  240.          BeginProperty Font 
  241.             name            =   "MS Sans Serif"
  242.             charset         =   0
  243.             weight          =   700
  244.             size            =   9.75
  245.             underline       =   0   'False
  246.             italic          =   0   'False
  247.             strikethrough   =   0   'False
  248.          EndProperty
  249.          ForeColor       =   &H00FFFFFF&
  250.          Height          =   285
  251.          HelpContextID   =   4
  252.          Left            =   120
  253.          TabIndex        =   0
  254.          Text            =   "txtCode"
  255.          Top             =   240
  256.          Width           =   975
  257.       End
  258.    End
  259.    Begin MSCommLib.MSComm MSComm1 
  260.       Left            =   1800
  261.       Top             =   3960
  262.       _Version        =   65536
  263.       _ExtentX        =   847
  264.       _ExtentY        =   847
  265.       _StockProps     =   0
  266.       CDTimeout       =   0
  267.       CommPort        =   1
  268.       CTSTimeout      =   0
  269.       DSRTimeout      =   0
  270.       DTREnable       =   -1  'True
  271.       Handshaking     =   0
  272.       InBufferSize    =   1024
  273.       InputLen        =   0
  274.       Interval        =   1000
  275.       NullDiscard     =   0   'False
  276.       OutBufferSize   =   512
  277.       ParityReplace   =   "?"
  278.       RThreshold      =   0
  279.       RTSEnable       =   0   'False
  280.       Settings        =   "9600,n,8,1"
  281.       SThreshold      =   0
  282.    End
  283.    Begin MSComDlg.CommonDialog CommonDialog1 
  284.       Left            =   1080
  285.       Top             =   3960
  286.       _Version        =   65536
  287.       _ExtentX        =   847
  288.       _ExtentY        =   847
  289.       _StockProps     =   0
  290.    End
  291.    Begin Crystal.CrystalReport CrystalReport1 
  292.       Left            =   360
  293.       Top             =   3960
  294.       _ExtentX        =   741
  295.       _ExtentY        =   741
  296.       _StockProps     =   0
  297.       ReportFileName  =   ""
  298.       Destination     =   0
  299.       WindowLeft      =   100
  300.       WindowTop       =   100
  301.       WindowWidth     =   490
  302.       WindowHeight    =   300
  303.       WindowTitle     =   ""
  304.       WindowBorderStyle=   2
  305.       WindowControlBox=   -1  'True
  306.       WindowMaxButton =   -1  'True
  307.       WindowMinButton =   -1  'True
  308.       CopiesToPrinter =   1
  309.       PrintFileName   =   ""
  310.       PrintFileType   =   0
  311.       SelectionFormula=   ""
  312.       GroupSelectionFormula=   ""
  313.       Connect         =   ""
  314.       UserName        =   ""
  315.       ReportSource    =   0
  316.       BoundReportHeading=   ""
  317.       BoundReportFooter=   0   'False
  318.    End
  319.    Begin VB.Label Label1 
  320.       Caption         =   "Contacts"
  321.       Height          =   255
  322.       Left            =   3360
  323.       TabIndex        =   19
  324.       Top             =   240
  325.       Width           =   1215
  326.    End
  327.    Begin MSDBCtls.DBCombo dbcContacts 
  328.       Bindings        =   "frmContacts.frx":0614
  329.       DataSource      =   "dtaContacts"
  330.       Height          =   315
  331.       HelpContextID   =   5
  332.       Left            =   3360
  333.       TabIndex        =   15
  334.       Top             =   480
  335.       Width           =   2535
  336.       _Version        =   65536
  337.       _ExtentX        =   4471
  338.       _ExtentY        =   556
  339.       _StockProps     =   77
  340.       ForeColor       =   0
  341.       BackColor       =   16777215
  342.       Style           =   2
  343.       ListField       =   "Contact"
  344.       BoundColumn     =   "Contact"
  345.    End
  346.    Begin VB.Menu mnuFile 
  347.       Caption         =   "&File"
  348.       Begin VB.Menu mnuImport 
  349.          Caption         =   "&Import"
  350.          HelpContextID   =   1
  351.       End
  352.       Begin VB.Menu mnuExport 
  353.          Caption         =   "&Export"
  354.          HelpContextID   =   2
  355.       End
  356.       Begin VB.Menu mnuSep1 
  357.          Caption         =   "-"
  358.       End
  359.       Begin VB.Menu mnuSetUp 
  360.          Caption         =   "&Program Setup"
  361.          HelpContextID   =   3
  362.       End
  363.       Begin VB.Menu mnuSep2 
  364.          Caption         =   "-"
  365.       End
  366.       Begin VB.Menu mnuExit 
  367.          Caption         =   "E&xit"
  368.       End
  369.    End
  370.    Begin VB.Menu mnuHelp 
  371.       Caption         =   "&Help"
  372.       Begin VB.Menu mnuContents 
  373.          Caption         =   "&Contents..."
  374.       End
  375.       Begin VB.Menu mnuAbout 
  376.          Caption         =   "&About Contact Manager..."
  377.       End
  378.    End
  379. Attribute VB_Name = "frmContacts"
  380. Attribute VB_Creatable = False
  381. Attribute VB_Exposed = False
  382. Dim sLastRecord As String
  383. Private Sub cmdAdd_Click()
  384.     sLastRecord = dtaContacts.Recordset.Bookmark
  385.     cmdAdd.Enabled = False
  386.     cmdSave.Enabled = True
  387.     cmdCancel.Enabled = True
  388.     dtaContacts.Recordset.AddNew
  389.     txtCode.SetFocus
  390. End Sub
  391. Private Sub cmdCancel_Click()
  392. cmdCancel.Enabled = False
  393. cmdSave.Enabled = False
  394. cmdAdd.Enabled = True
  395. dtaContacts.Recordset.Bookmark = sLastRecord
  396. End Sub
  397. Private Sub cmdQuery_Click()
  398.   frmQuery.Show
  399. End Sub
  400. Private Sub cmdDelete_Click()
  401.  If MsgBox("OK To Delete?", vbQuestion + vbYesNo, "Deleting " & txtContact) = vbYes Then
  402.  dtaContacts.Recordset.Delete
  403.  dtaContacts.Recordset.MovePrevious
  404.  End If
  405. End Sub
  406. Private Sub cmdReport_Click()
  407. CrystalReport1.Destination = 0
  408. CrystalReport1.ReportFileName = "C:\VB40\SAMS\CONTACTS.RPT"
  409. CrystalReport1.Action = 1
  410. End Sub
  411. Private Sub cmdSave_Click()
  412.     dtaContacts.Recordset.Update
  413.     cmdSave.Enabled = False
  414.     cmdCancel.Enabled = False
  415.     cmdAdd.Enabled = True
  416. End Sub
  417. Private Sub cbxNames_KeyPress(KeyAscii As Integer)
  418.     If KeyAscii = 13 Then cmdFind.Value = True
  419. End Sub
  420. Private Sub dbcContacts_Click(Area As Integer)
  421. Dim sCriteria As String
  422. sCriteria = "Contact = '" & dbcContacts & "'"
  423. dtaContacts.Recordset.FindFirst sCriteria
  424. End Sub
  425. Private Sub Form_Activate()
  426. 'dbcContacts.TEXT = dtaContacts.Recordset("Contact")
  427. End Sub
  428. Sub DialOut(sCallNumber As String)
  429. On Error GoTo LocalHandler
  430. MSComm1.CommPort = 2
  431. MSComm1.Settings = "9600,N,8,1"
  432. MSComm1.InputLen = 0
  433. MSComm1.PortOpen = True
  434. MSComm1.Output = "AT" + Chr$(13)
  435.     dummy = DoEvents()
  436. Loop Until MSComm1.InBufferCount >= 2
  437. MSComm1.InBufferCount = 0
  438. MSComm1.Output = "ATDT" + sCallNumber + Chr$(13)
  439. MsgBox "Pick Up The Phone And Click OK", vbExclamation, "Dialing: " & sCallNumber & "..."
  440. MSComm1.PortOpen = False
  441. Exit Sub
  442. LocalHandler:
  443.   MsgBox Error$(Err), vbCritical, "Modem Communications Error!"
  444.   Exit Sub
  445. End Sub
  446. Sub ExportFile(sFileOut As String)
  447. Dim dbContacts As Database
  448. Dim rsContacts As Recordset
  449. Dim iFileNumber As Integer
  450. Dim iRecordNumber As Integer
  451. Dim NL As String
  452. Dim CurrentRecord As ContactRecord
  453. On Error GoTo LocalHandler
  454. NL = Chr$(13) & Chr$(10)
  455. Set dbContacts = OpenDatabase("c:\vb40\sams\contacts.mdb")
  456. Set rsContacts = dbContacts.OpenRecordset("Contacts", dbOpenDynaset)
  457. rsContacts.MoveFirst
  458. iFileNumber = FreeFile
  459. Open sFileOut For Random As #iFileNumber Len = Len(CurrentRecord)
  460. Do Until rsContacts.EOF
  461. iRecordNumber = iRecordNumber + 1
  462. CurrentRecord.code = rsContacts("Code")
  463. CurrentRecord.Company = rsContacts("Company")
  464. CurrentRecord.Address = rsContacts("Address")
  465. CurrentRecord.City = rsContacts("City")
  466. CurrentRecord.State = rsContacts("State")
  467. CurrentRecord.Zip = rsContacts("Zip")
  468. CurrentRecord.Contact = rsContacts("Contact")
  469. CurrentRecord.Phone = rsContacts("Phone")
  470. CurrentRecord.NewLine = NL
  471. Put #iFileNumber, iRecordNumber, CurrentRecord   ' Write record to file.
  472. rsContacts.Delete
  473. rsContacts.MoveNext
  474. dtaContacts.Refresh
  475. Close #iFileNumber
  476. rsContacts.Close
  477. dbContacts.Close
  478. MsgBox "Table Has Been Emptied!", vbInformation, "Data Export Successful!"
  479. Exit Sub
  480. LocalHandler:
  481.   MsgBox Error$(Err), vbCritical, "File Export Error"
  482.   Exit Sub
  483. End Sub
  484. Sub ImportFile(sFileIn As String)
  485. Dim dbContacts As Database
  486. Dim rsContacts As Recordset
  487. Dim iFileNumber, iRecordNumber As Integer
  488. Dim iFileSize, iTotalRecords As Long
  489. Dim CurrentRecord As ContactRecord
  490. On Error GoTo LocalHandler
  491. Set dbContacts = OpenDatabase("c:\vb40\sams\contacts.mdb")
  492. Set rsContacts = dbContacts.OpenRecordset("Contacts", dbOpenDynaset)
  493. iFileNumber = FreeFile
  494. Open sFileIn For Random As iFileNumber Len = Len(CurrentRecord)
  495. iFileSize = LOF(iFileNumber)
  496. iTotalRecords = Int(iFileSize / Len(CurrentRecord))
  497. iRecordNumber = 1
  498. Do While iRecordNumber <= iTotalRecords
  499.     Get iFileNumber, iRecordNumber, CurrentRecord
  500.     rsContacts.AddNew
  501.     rsContacts("Code") = CurrentRecord.code
  502.     rsContacts("Company") = CurrentRecord.Company
  503.     rsContacts("Address") = CurrentRecord.Address
  504.     rsContacts("City") = CurrentRecord.City
  505.     rsContacts("State") = CurrentRecord.State
  506.     rsContacts("Zip") = CurrentRecord.Zip
  507.     rsContacts("Contact") = CurrentRecord.Contact
  508.     rsContacts("Phone") = CurrentRecord.Phone
  509.     rsContacts.Update
  510.     iRecordNumber = iRecordNumber + 1
  511. rsContacts.Close
  512. dtaContacts.Refresh
  513. MsgBox "New Records Have Been Added!", vbInformation, "Data Import Successful!"
  514. Exit Sub
  515. LocalHandler:
  516.   MsgBox Error$(Err), vbCritical, "File Import Error"
  517. Exit Sub
  518. End Sub
  519. Private Sub Form_Load()
  520. Dim iFileNumber As Integer
  521. Dim sCompany, sUser, sConfigFile As String
  522. On Error GoTo LocalHandler
  523. sConfigFile = Dir("C:\vb40\sams\contacts.cfg")
  524. If sConfigFile = "" Then
  525. Me.Caption = "Contact Manager"
  526. sConfigFile = "C:\vb40\sams\" & sConfigFile
  527. iFileNumber = FreeFile
  528. Open sConfigFile For Input As #iFileNumber
  529.     If LOF(iFileNumber) > 0 Then
  530.     Line Input #iFileNumber, sUser
  531.     Line Input #iFileNumber, sCompany
  532.     Close #iFileNumber
  533.     Me.Caption = "Contact Manager: " + sUser + " At " + sCompany + ""
  534.     Else
  535.     Close #iFileNumber
  536.     Me.Caption = "EVB Contact Manager"
  537.     End If
  538. End If
  539. 'Refresh
  540. Exit Sub
  541. LocalHandler:
  542.   MsgBox Error$(Err), vbCritical, "Error Reading Setup File"
  543.   Exit Sub
  544. End Sub
  545. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  546. lblPhone.Visible = False
  547. End Sub
  548. Private Sub Form_Unload(Cancel As Integer)
  549. RetVal = WinHelp(hwnd, dummy$, HELP_QUIT, 0)
  550. End Sub
  551. Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  552. lblPhone.Visible = False
  553. End Sub
  554. Private Sub Frame2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  555. lblPhone.Visible = False
  556. End Sub
  557. Private Sub mnuContents_Click()
  558. RetVal = WinHelp(frmContacts.hwnd, "c:\vb40\hc\contacts.hlp", HELP_INDEX, CLng(0))
  559. End Sub
  560. Private Sub mnuExit_Click()
  561. End Sub
  562. Private Sub Form_DblClick()
  563. frmGrid.Show
  564. End Sub
  565. Private Sub mnuExport_Click()
  566. Dim sFileName As String
  567. On Error GoTo LocalHandler
  568. CommonDialog1.CancelError = True
  569. CommonDialog1.DialogTitle = "Enter Export File Name"
  570. CommonDialog1.Filter = "Export Data Files (*.DAT)|*.DAT|All Files (*.*)|*.*"
  571. CommonDialog1.FilterIndex = 1
  572. CommonDialog1.DefaultExt = "DAT"
  573. CommonDialog1.InitDir = "C:\VB40\SAMS"
  574. CommonDialog1.Action = 2
  575. sFileName = CommonDialog1.filename
  576. If sFileName <> "" Then
  577. ExportFile sFileName
  578. End If
  579. Exit Sub
  580. LocalHandler:
  581. Exit Sub
  582. End Sub
  583. Private Sub mnuImport_Click()
  584. Dim sFileName As String
  585. On Error GoTo LocalHandler
  586. CommonDialog1.CancelError = True
  587. CommonDialog1.DialogTitle = "Select Data File For Import"
  588. CommonDialog1.Filter = "Import Data Files (*.DAT)|*.DAT|All Files (*.*)|*.*"
  589. CommonDialog1.FilterIndex = 1
  590. CommonDialog1.InitDir = "C:\VB40\SAMS"
  591. CommonDialog1.Action = 1
  592. sFileName = CommonDialog1.filename
  593. If sFileName <> "" Then
  594. ImportFile sFileName
  595. End If
  596. Exit Sub
  597. LocalHandler:
  598.   Exit Sub
  599. End Sub
  600. Private Sub mnuSetUp_Click()
  601. Dim sUser, sCompany As String
  602. Dim iFileNumber As Integer
  603. On Error GoTo LocalHandler
  604. sUser = InputBox$("Please Enter Your Name: ", "Program Setup Information")
  605. If sUser = "" Then Exit Sub
  606. sCompany = InputBox("Please Enter The Name Of Your Company: ", "Program Setup Information")
  607. If sCompany = "" Then Exit Sub
  608. iFileNumber = FreeFile
  609. Open "C:\vb40\sams\Contacts.Cfg" For Output As #iFileNumber
  610. Print #iFileNumber, sUser
  611. Print #iFileNumber, sCompany
  612. Close #iFileNumber
  613. Me.Caption = "Contact Manager: " & sUser & " At " & sCompany
  614. Exit Sub
  615. LocalHandler:
  616.   MsgBox Error$(Err), vbCritical, "Error Creating Setup File"
  617.   Exit Sub
  618. End Sub
  619. Private Sub picPhone_Click()
  620. Dim sPhoneNumber As String
  621. sPhoneNumber = dtaContacts.Recordset("PHONE")
  622. If Mid(sPhoneNumber, 1, 1) = "(" Then
  623.    sPhoneNumber = "1-" + sPhoneNumber
  624. End If
  625. DialOut sPhoneNumber
  626. End Sub
  627. Private Sub picPhone_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  628. lblPhone.Visible = True
  629. End Sub
  630. Private Sub Text8_KeyPress(KeyAscii As Integer)
  631.     If KeyAscii = 13 Then txtCode.SetFocus
  632. End Sub
  633. Private Sub txtAddress_KeyPress(KeyAscii As Integer)
  634.    If KeyAscii = 13 Then txtCity.SetFocus
  635. End Sub
  636. Private Sub txtCity_KeyPress(KeyAscii As Integer)
  637.    If KeyAscii = 13 Then txtState.SetFocus
  638. End Sub
  639. Private Sub txtCode_KeyPress(KeyAscii As Integer)
  640.     If KeyAscii = 13 Then txtName.SetFocus
  641. End Sub
  642. Private Sub txtContact_KeyPress(KeyAscii As Integer)
  643.     If KeyAscii = 13 Then Text8.SetFocus
  644. End Sub
  645. Private Sub txtName_KeyPress(KeyAscii As Integer)
  646.    If KeyAscii = 13 Then txtAddress.SetFocus
  647. End Sub
  648. Private Sub txtState_KeyPress(KeyAscii As Integer)
  649.    If KeyAscii = 13 Then txtZip.SetFocus
  650. End Sub
  651. Private Sub txtZip_KeyPress(KeyAscii As Integer)
  652.     If KeyAscii = 13 Then txtContact.SetFocus
  653. End Sub
  654.