home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161b.iso / handson / archive / Issue159 / files / vbwkshp / AddNew.frm (.txt) next >
Encoding:
Visual Basic Form  |  1999-10-02  |  2.9 KB  |  105 lines

  1. VERSION 5.00
  2. Begin VB.Form AddRecipient 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Add Recipient"
  5.    ClientHeight    =   3195
  6.    ClientLeft      =   2760
  7.    ClientTop       =   3750
  8.    ClientWidth     =   6030
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   3195
  13.    ScaleWidth      =   6030
  14.    ShowInTaskbar   =   0   'False
  15.    Begin VB.Data Data1 
  16.       Caption         =   "Data1"
  17.       Connect         =   "Access"
  18.       DatabaseName    =   "C:\pcplus\vbwkshp\issue159\newslist.mdb"
  19.       DefaultCursorType=   0  'DefaultCursor
  20.       DefaultType     =   2  'UseODBC
  21.       Exclusive       =   0   'False
  22.       Height          =   375
  23.       Left            =   480
  24.       Options         =   0
  25.       ReadOnly        =   0   'False
  26.       RecordsetType   =   1  'Dynaset
  27.       RecordSource    =   "Recipients"
  28.       Top             =   2160
  29.       Visible         =   0   'False
  30.       Width           =   1575
  31.    End
  32.    Begin VB.CommandButton Save 
  33.       Caption         =   "Add"
  34.       Height          =   375
  35.       Left            =   4680
  36.       TabIndex        =   5
  37.       Top             =   600
  38.       Width           =   1215
  39.    End
  40.    Begin VB.TextBox xAddress 
  41.       Height          =   375
  42.       Left            =   480
  43.       TabIndex        =   2
  44.       Top             =   1440
  45.       Width           =   3255
  46.    End
  47.    Begin VB.TextBox xName 
  48.       Height          =   375
  49.       Left            =   480
  50.       TabIndex        =   1
  51.       Top             =   480
  52.       Width           =   3255
  53.    End
  54.    Begin VB.CommandButton OKButton 
  55.       Caption         =   "Exit"
  56.       Height          =   375
  57.       Left            =   4680
  58.       TabIndex        =   0
  59.       Top             =   120
  60.       Width           =   1215
  61.    End
  62.    Begin VB.Label Label2 
  63.       Caption         =   "Address"
  64.       Height          =   375
  65.       Left            =   480
  66.       TabIndex        =   4
  67.       Top             =   1080
  68.       Width           =   1335
  69.    End
  70.    Begin VB.Label Label1 
  71.       Caption         =   "Name"
  72.       Height          =   375
  73.       Left            =   480
  74.       TabIndex        =   3
  75.       Top             =   120
  76.       Width           =   1335
  77.    End
  78. Attribute VB_Name = "AddRecipient"
  79. Attribute VB_GlobalNameSpace = False
  80. Attribute VB_Creatable = False
  81. Attribute VB_PredeclaredId = True
  82. Attribute VB_Exposed = False
  83. Option Explicit
  84. Private Sub Form_Activate()
  85. Data1.Refresh
  86. End Sub
  87. Private Sub OKButton_Click()
  88. Me.Hide
  89. End Sub
  90. Private Sub Save_Click()
  91. On Error GoTo A
  92. If xName.Text <> "" Then
  93.     With Data1.Recordset
  94.         .AddNew
  95.         !Name = xName.Text
  96.         !EMail = xAddress.Text
  97.         .Update
  98.     End With
  99. End If
  100. xAddress.Text = ""
  101. xName.Text = ""
  102. Exit Sub
  103. MsgBox ("Database update failed")
  104. End Sub
  105.