home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form AddNew
- Caption = "Add A New Contact"
- ClientHeight = 2670
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 5205
- LinkTopic = "Form2"
- ScaleHeight = 2670
- ScaleWidth = 5205
- StartUpPosition = 2 'CenterScreen
- Begin VB.TextBox txtName
- Height = 285
- Left = 120
- TabIndex = 7
- Top = 360
- Width = 4935
- End
- Begin VB.TextBox txtEmail
- Height = 285
- Left = 120
- TabIndex = 3
- Top = 1080
- Width = 4935
- End
- Begin VB.TextBox txtPhone
- Height = 285
- Left = 120
- TabIndex = 2
- Top = 1800
- Width = 4935
- End
- Begin VB.CommandButton AddNewCancel
- Caption = "Cancel"
- Height = 255
- Left = 3360
- TabIndex = 1
- Top = 2280
- Width = 975
- End
- Begin VB.CommandButton AddNewOK
- Caption = "OK"
- Height = 255
- Left = 4440
- TabIndex = 0
- Top = 2280
- Width = 615
- End
- Begin VB.Label Label1
- Caption = "Name"
- Height = 255
- Left = 120
- TabIndex = 6
- Top = 120
- Width = 1215
- End
- Begin VB.Label Label2
- Caption = "Email:"
- Height = 255
- Left = 120
- TabIndex = 5
- Top = 840
- Width = 615
- End
- Begin VB.Label Label3
- Caption = "Phone Number:"
- Height = 255
- Left = 120
- TabIndex = 4
- Top = 1560
- Width = 1935
- End
- Attribute VB_Name = "AddNew"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub AddNewCancel_Click()
- Close
- Unload Me
- End Sub
- Private Sub AddNewOK_Click()
- Dim db As Database
- Dim rsNewContact As Recordset
- Set db = OpenDatabase(App.Path + "\" + "connections.mdb")
- Set rsNewContacts = db.OpenRecordset("Contacts")
- rsNewContacts.MoveLast 'moves to spot after the last person in the database
- 'the following lines of code are what actually add the user info to the database.
- With rsNewContacts
- .AddNew 'creats buffers to hold data to be added to the current recordset
- !Name = Trim(txtName.Text) 'adds txtname.Text to the field name in the database
- !email = Trim(txtEmail.Text) 'adds txtemail.Text to the field email in the database
- !phone = Trim(txtPhone.Text) 'adds txtPhone.Text to the field phone in the database
- .Update ' saves the new contact information
- End With
- db.Close
- MsgBox "New Contact -- " + txtName.Text + " -- Was Added Succesfully", vbOKOnly
- AddressMain.cmbContacts.AddItem txtName.Text 'adds the new user to the list on the main form
- Close
- Unload Me
- End Sub
-