home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Insform
- Caption = "Insert a new Client"
- ClientHeight = 5220
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 8550
- LinkTopic = "Form1"
- ScaleHeight = 5220
- ScaleWidth = 8550
- StartUpPosition = 1 'CenterOwner
- Begin VB.TextBox EntryType
- Enabled = 0 'False
- Height = 285
- Left = 5400
- MaxLength = 21
- TabIndex = 48
- Top = 3480
- Width = 2175
- End
- Begin VB.CommandButton Command3
- Caption = "Cle&ar"
- Height = 375
- Left = 3960
- TabIndex = 46
- Top = 4560
- Width = 1095
- End
- Begin VB.TextBox ID
- Enabled = 0 'False
- Height = 285
- Left = 5400
- MaxLength = 23
- TabIndex = 31
- Top = 1680
- Width = 2175
- End
- Begin VB.TextBox Phone4Ext
- Height = 285
- Left = 7680
- MaxLength = 5
- TabIndex = 43
- Top = 3120
- Width = 735
- End
- Begin VB.TextBox Phone4
- Height = 285
- Left = 5400
- MaxLength = 21
- TabIndex = 42
- Top = 3120
- Width = 2175
- End
- Begin VB.TextBox Phone3Ext
- Height = 285
- Left = 7680
- MaxLength = 5
- TabIndex = 40
- Top = 2760
- Width = 735
- End
- Begin VB.TextBox Phone3
- Height = 285
- Left = 5400
- MaxLength = 21
- TabIndex = 39
- Top = 2760
- Width = 2175
- End
- Begin VB.TextBox Phone2Ext
- Height = 285
- Left = 7680
- MaxLength = 5
- TabIndex = 37
- Top = 2400
- Width = 735
- End
- Begin VB.TextBox Phone2
- Height = 285
- Left = 5400
- MaxLength = 21
- TabIndex = 36
- Top = 2400
- Width = 2175
- End
- Begin VB.TextBox Phone1Ext
- Height = 285
- Left = 7680
- MaxLength = 5
- TabIndex = 34
- Top = 2040
- Width = 735
- End
- Begin VB.TextBox Phone1
- Height = 285
- Left = 5400
- MaxLength = 21
- TabIndex = 33
- Top = 2040
- Width = 2175
- End
- Begin VB.TextBox Country
- Height = 285
- Left = 5400
- MaxLength = 39
- TabIndex = 29
- Top = 1320
- Width = 2175
- End
- Begin VB.TextBox Zip
- Height = 285
- Left = 5400
- MaxLength = 19
- TabIndex = 27
- Top = 960
- Width = 2175
- End
- Begin VB.TextBox State
- Height = 285
- Left = 5400
- MaxLength = 39
- TabIndex = 25
- Top = 600
- Width = 2175
- End
- Begin VB.TextBox City
- Height = 285
- Left = 5400
- MaxLength = 39
- TabIndex = 23
- Top = 240
- Width = 2175
- End
- Begin VB.TextBox Address2
- Height = 285
- Left = 1440
- MaxLength = 39
- TabIndex = 21
- Top = 3840
- Width = 2175
- End
- Begin VB.TextBox Address1
- Height = 285
- Left = 1440
- MaxLength = 39
- TabIndex = 19
- Top = 3480
- Width = 2175
- End
- Begin VB.TextBox Division
- Height = 285
- Left = 1440
- MaxLength = 39
- TabIndex = 17
- Top = 3120
- Width = 2175
- End
- Begin VB.TextBox Dept
- Height = 285
- Left = 1440
- MaxLength = 39
- TabIndex = 15
- Top = 2760
- Width = 2175
- End
- Begin VB.TextBox Company
- Height = 285
- Left = 1440
- MaxLength = 59
- TabIndex = 13
- Top = 2400
- Width = 2175
- End
- Begin VB.TextBox Salutation
- Height = 285
- Left = 1440
- MaxLength = 39
- TabIndex = 11
- Top = 2040
- Width = 2175
- End
- Begin VB.TextBox Position
- Height = 285
- Left = 1440
- MaxLength = 59
- TabIndex = 9
- Top = 1680
- Width = 2175
- End
- Begin VB.TextBox LastName
- Height = 285
- Left = 1440
- MaxLength = 59
- TabIndex = 7
- Top = 1320
- Width = 2175
- End
- Begin VB.TextBox Initial
- Height = 285
- Left = 1440
- MaxLength = 1
- TabIndex = 5
- Top = 960
- Width = 2175
- End
- Begin VB.TextBox FirstName
- Height = 285
- Left = 1440
- MaxLength = 39
- TabIndex = 3
- Top = 600
- Width = 2175
- End
- Begin VB.TextBox Mr
- Height = 285
- Left = 1440
- MaxLength = 39
- TabIndex = 1
- Top = 240
- Width = 2175
- End
- Begin VB.CommandButton Command2
- Cancel = -1 'True
- Caption = "Cancel"
- Height = 375
- Left = 7320
- TabIndex = 45
- Top = 4560
- Width = 1095
- End
- Begin VB.CommandButton Command1
- Caption = "&OK"
- Default = -1 'True
- Height = 375
- Left = 5640
- TabIndex = 44
- Top = 4560
- Width = 1095
- End
- Begin VB.Label Label21
- Caption = "Entry Type"
- Enabled = 0 'False
- Height = 255
- Left = 4080
- TabIndex = 47
- Top = 3480
- Width = 1215
- End
- Begin VB.Label Label20
- Caption = "Phone &4"
- Height = 255
- Left = 4080
- TabIndex = 41
- Top = 3120
- Width = 1215
- End
- Begin VB.Label Label19
- Caption = "Phone &3"
- Height = 255
- Left = 4080
- TabIndex = 38
- Top = 2760
- Width = 1215
- End
- Begin VB.Label Label18
- Caption = "Phone &2"
- Height = 255
- Left = 4080
- TabIndex = 35
- Top = 2400
- Width = 1215
- End
- Begin VB.Label Label17
- Caption = "Phone &1"
- Height = 255
- Left = 4080
- TabIndex = 32
- Top = 2040
- Width = 1215
- End
- Begin VB.Label Label16
- Caption = "Identification"
- Enabled = 0 'False
- Height = 255
- Left = 4080
- TabIndex = 30
- Top = 1680
- Width = 1215
- End
- Begin VB.Label Label15
- Caption = "Cou&ntry"
- Height = 255
- Left = 4080
- TabIndex = 28
- Top = 1320
- Width = 1215
- End
- Begin VB.Label Label14
- Caption = "&Zip/Postal"
- Height = 255
- Left = 4080
- TabIndex = 26
- Top = 960
- Width = 1215
- End
- Begin VB.Label Label13
- Caption = "St&/Prov"
- Height = 255
- Left = 4080
- TabIndex = 24
- Top = 600
- Width = 1215
- End
- Begin VB.Label Label12
- Caption = "&City"
- Height = 255
- Left = 4080
- TabIndex = 22
- Top = 240
- Width = 1215
- End
- Begin VB.Label Label11
- Caption = "Addre&ss Line 2"
- Height = 255
- Left = 120
- TabIndex = 20
- Top = 3840
- Width = 1215
- End
- Begin VB.Label Label10
- Caption = "Add&ress Line 1"
- Height = 255
- Left = 120
- TabIndex = 18
- Top = 3480
- Width = 1215
- End
- Begin VB.Label Label9
- Caption = "Di&vision"
- Height = 255
- Left = 120
- TabIndex = 16
- Top = 3120
- Width = 1215
- End
- Begin VB.Label Label8
- Caption = "D&ept"
- Height = 255
- Left = 120
- TabIndex = 14
- Top = 2760
- Width = 1215
- End
- Begin VB.Label Label7
- Caption = "Compan&y Name"
- Height = 255
- Left = 120
- TabIndex = 12
- Top = 2400
- Width = 1215
- End
- Begin VB.Label Label6
- Caption = "Salu&tation"
- Height = 255
- Left = 120
- TabIndex = 10
- Top = 2040
- Width = 1215
- End
- Begin VB.Label Label5
- Caption = "&Position"
- Height = 255
- Left = 120
- TabIndex = 8
- Top = 1680
- Width = 1215
- End
- Begin VB.Label Label4
- Caption = "&Last Name"
- Height = 255
- Left = 120
- TabIndex = 6
- Top = 1320
- Width = 1215
- End
- Begin VB.Label Label3
- Caption = "&Initial"
- Height = 255
- Left = 120
- TabIndex = 4
- Top = 960
- Width = 1215
- End
- Begin VB.Label Label2
- Caption = "&First Name"
- Height = 255
- Left = 120
- TabIndex = 2
- Top = 600
- Width = 1215
- End
- Begin VB.Label Label1
- Caption = "&Mr/Ms"
- Height = 255
- Left = 120
- TabIndex = 0
- Top = 240
- Width = 1215
- End
- Attribute VB_Name = "Insform"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '==========================================================================
- ' This code and information is provided "as is" without warranty of any
- ' kind, either expressed or implied, including but not limited to the
- ' implied warranties of merchantability and/or fitness for a particular
- ' purpose..
- ' Copyright (c) 1998 Multiactive Software Inc. All Rights Reserved.
- '==========================================================================
- Private Sub Command1_Click() 'Company
- If ClientInsertType = 1 Then 'If this is Company
- If Insform.Company <> "" Then 'If Lastname field isn't empty then
- Call InsertCompany
- Else
- MsgBox ("Company Name is a Required field.") 'Warn User that Last name is required
- Insform.Company.SetFocus 'Set Focus back to the Last_Name field.
- Exit Sub
- End If
- End If
- If ClientInsertType = 2 Then 'Contact to current client
- If Insform.LastName <> "" Then 'If Lastname has data
- Call InsertContact 'Then call Subroutine to Insert the Contact
- Else
- MsgBox ("Last Name is a required field.") 'Warn user that a name is required
- Insform.LastName.SetFocus 'Set focus in the Lastname field
- Exit Sub
- End If
- End If
- If ClientInsertType = 3 Then 'If InsertType is an Individual
- If Insform.LastName <> "" Then 'If Lastname is not blank
- Call InsertIndividual 'Call Subroutine to insert Individual
- Else
- MsgBox ("Last Name is a Required field.") 'Warn user that Last Name is Required
- Insform.LastName.SetFocus 'SetFocus back to the Lastname field
- Exit Sub
- End If
- End If
-
- If ClientInsertType = 4 Then 'If the InsertType is a contact of new company Then
-
- If Insform.Company <> "" And Insform.LastName <> "" Then 'If both Company and Lastname have data
- Call InsertCompany 'First call Subroutine to Insert the Company
-
- Set dbsrecClientMax = dbs.OpenRecordset("SELECT MAX(Sequence_Number) FROM Client") 'Get the new entry info by using the biggest sequence number
- TempSeqNum = dbsrecClientMax.Fields(0)
- Set dbsrecClientTemp = dbs.OpenRecordset("SELECT Client_Id, Contact_Number, Record_Type, Address_Id FROM Client WHERE Sequence_Number=" & TempSeqNum)
- ci = dbsrecClientTemp.Fields(0)
- cn = dbsrecClientTemp.Fields(1)
- rectype = dbsrecClientTemp.Fields(2)
- ClientForm.ID = ci
-
- If rectype = 1 Then 'If it is a company
- Call InsertContact 'Then call Subroutine to Insert the Contact
- Else
- MsgBox ("Error to get the new Company Id. Company client is already created.")
- End If
- Else
- MsgBox ("Last Name and Company are required fields.") 'Warn user that a name is required
- Insform.LastName.SetFocus 'Set focus in the Lastname field
- Exit Sub
- End If
- End If
- dbsrecClient.Close
- dbs.Close
- 'To get the new entry's info by using the sequence number and update the recordsets
- Set dbs = OpenDatabase("", False, False, "ODBC;DSN=" & DSN & ";UID=" & UID & ";PWD=" & PWD & ";")
- Set dbsrecClient = dbs.OpenRecordset("SELECT Client_Id, Contact_Number, Record_Type, Address_Id FROM Client")
- Set dbsrecClientMax = dbs.OpenRecordset("SELECT MAX(Sequence_Number) FROM Client")
- TempSeqNum = dbsrecClientMax.Fields(0)
- Set dbsrecClientTemp = dbs.OpenRecordset("SELECT Client_Id, Contact_Number, Record_Type, Address_Id FROM Client WHERE Sequence_Number=" & TempSeqNum)
- ci = dbsrecClientTemp.Fields(0)
- cn = dbsrecClientTemp.Fields(1)
- rectype = dbsrecClientTemp.Fields(2)
- dbsrecClientMax.Close
- dbsrecClientTemp.Close
- Persform.Show 'Display the Persform
- Unload Me 'Terminate this form
- End Sub
- Private Sub Command2_Click() 'Cancel
- Persform.Show
- Unload Me 'User chose Cancel, so Unload the form without doing anything
- End Sub
- Private Sub Command3_Click() 'Clear
- Set ClientForm = Insform
- Call ClearFields
- Set ClientForm = Nothing
- End Sub
- Private Sub Form_Load()
- Set ClientForm = Insform
- Call ClearFields 'Clear all the fields
- Set ClientForm = Nothing
- If ClientInsertType = 1 Then 'If the user chose Company
- 'Setup the form
- Insform.EntryType.Text = "Company"
- Insform.ID.Enabled = True
- Insform.Label16.Enabled = True
- Insform.Mr.Enabled = False
- Insform.FirstName.Enabled = False
- Insform.Initial.Enabled = False
- Insform.LastName.Enabled = False
- Insform.Position.Enabled = False
- Insform.Salutation.Enabled = False
- Insform.Label1.Enabled = False
- Insform.Label2.Enabled = False
- Insform.Label3.Enabled = False
- Insform.Label4.Enabled = False
- Insform.Label5.Enabled = False
- Insform.Label6.Enabled = False
- Insform.Label7.Enabled = True
- Insform.Label8.Enabled = True
- Insform.Label9.Enabled = True
- Insform.Label10.Enabled = True
- Insform.Label11.Enabled = True
- Insform.Label12.Enabled = True
- Insform.Label13.Enabled = True
- Insform.Label14.Enabled = True
- Insform.Label15.Enabled = True
- Insform.Company.Enabled = True
- Insform.Dept.Enabled = True
- Insform.Division.Enabled = True
- Insform.Address1.Enabled = True
- Insform.Address2.Enabled = True
- Insform.City.Enabled = True
- Insform.State.Enabled = True
- Insform.Zip.Enabled = True
- Insform.Country.Enabled = True
-
- ElseIf ClientInsertType = 2 Then 'If the user chose Contact of the current entry
- If rectype = 2 Or rectype = 32 Then 'If Individual or Individual contact
- Set ClientForm = Insform
- Call Personfill(0) 'Fill out the pre-setup fields
- Set ClientForm = Nothing
- 'Setup the form
- Insform.EntryType.Text = "Individual Contact"
- Insform.ID.Enabled = False
- Insform.Label16.Enabled = False
- Insform.ID.Text = ci
- Insform.Mr.Enabled = True
- Insform.FirstName.Enabled = True
- Insform.Initial.Enabled = True
- Insform.LastName.Enabled = True
- Insform.Position.Enabled = True
- Insform.Salutation.Enabled = True
- Insform.Label1.Enabled = True
- Insform.Label2.Enabled = True
- Insform.Label3.Enabled = True
- Insform.Label4.Enabled = True
- Insform.Label5.Enabled = True
- Insform.Label6.Enabled = True
- Insform.Label7.Enabled = False
- Insform.Label8.Enabled = False
- Insform.Label9.Enabled = False
- Insform.Label10.Enabled = False
- Insform.Label11.Enabled = False
- Insform.Label12.Enabled = False
- Insform.Label13.Enabled = False
- Insform.Label14.Enabled = False
- Insform.Label15.Enabled = False
- Insform.Company.Enabled = False
- Insform.Dept.Enabled = False
- Insform.Division.Enabled = False
- Insform.Address1.Enabled = False
- Insform.Address2.Enabled = False
- Insform.City.Enabled = False
- Insform.State.Enabled = False
- Insform.Zip.Enabled = False
- Insform.Country.Enabled = False
- Insform.Mr.Text = ""
- Insform.FirstName.Text = ""
- Insform.Initial.Text = ""
- Insform.LastName.Text = ""
- Insform.Position.Text = ""
- Insform.Salutation.Text = ""
-
- ElseIf rectype = 1 Or rectype = 31 Then 'If Company or Company Contact
- Set ClientForm = Insform
- Call Companyfill(0) 'Fill out the pre-setup fields
- Set ClientForm = Nothing
- 'Setup the form
- Insform.EntryType.Text = "Company Contact"
- Insform.ID.Enabled = False
- Insform.Label16.Enabled = False
- Insform.ID.Text = ci
- Insform.Mr.Enabled = True
- Insform.FirstName.Enabled = True
- Insform.Initial.Enabled = True
- Insform.LastName.Enabled = True
- Insform.Position.Enabled = True
- Insform.Salutation.Enabled = True
- Insform.Label1.Enabled = True
- Insform.Label2.Enabled = True
- Insform.Label3.Enabled = True
- Insform.Label4.Enabled = True
- Insform.Label5.Enabled = True
- Insform.Label6.Enabled = True
- Insform.Label7.Enabled = False
- Insform.Label8.Enabled = False
- Insform.Label9.Enabled = False
- Insform.Label10.Enabled = False
- Insform.Label11.Enabled = False
- Insform.Label12.Enabled = False
- Insform.Label13.Enabled = False
- Insform.Label14.Enabled = False
- Insform.Label15.Enabled = False
- Insform.Company.Enabled = False
- Insform.Dept.Enabled = False
- Insform.Division.Enabled = False
- Insform.Address1.Enabled = False
- Insform.Address2.Enabled = False
- Insform.City.Enabled = False
- Insform.State.Enabled = False
- Insform.Zip.Enabled = False
- Insform.Country.Enabled = False
- End If
- ElseIf ClientInsertType = 3 Then 'If the user chose Individual
- 'Setup the form
- Insform.EntryType.Text = "Individual"
- Insform.ID.Enabled = True
- Insform.Label16.Enabled = True
- Insform.Mr.Enabled = True
- Insform.FirstName.Enabled = True
- Insform.Initial.Enabled = True
- Insform.LastName.Enabled = True
- Insform.Position.Enabled = True
- Insform.Salutation.Enabled = True
- Insform.Label1.Enabled = True
- Insform.Label2.Enabled = True
- Insform.Label3.Enabled = True
- Insform.Label4.Enabled = True
- Insform.Label5.Enabled = True
- Insform.Label6.Enabled = True
- Insform.Label7.Enabled = True
- Insform.Label8.Enabled = True
- Insform.Label9.Enabled = True
- Insform.Label10.Enabled = True
- Insform.Label11.Enabled = True
- Insform.Label12.Enabled = True
- Insform.Label13.Enabled = True
- Insform.Label14.Enabled = True
- Insform.Label15.Enabled = True
- Insform.Company.Enabled = True
- Insform.Dept.Enabled = True
- Insform.Division.Enabled = True
- Insform.Address1.Enabled = True
- Insform.Address2.Enabled = True
- Insform.City.Enabled = True
- Insform.State.Enabled = True
- Insform.Zip.Enabled = True
- Insform.Country.Enabled = True
- ElseIf ClientInsertType = 4 Then 'If the user chose Contact of new Company entry
- 'Setup the form
- Insform.EntryType.Text = "Company and Contact"
- Insform.ID.Enabled = True
- Insform.Label16.Enabled = True
- Insform.Mr.Enabled = True
- Insform.FirstName.Enabled = True
- Insform.Initial.Enabled = True
- Insform.LastName.Enabled = True
- Insform.Position.Enabled = True
- Insform.Salutation.Enabled = True
- Insform.Label1.Enabled = True
- Insform.Label2.Enabled = True
- Insform.Label3.Enabled = True
- Insform.Label4.Enabled = True
- Insform.Label5.Enabled = True
- Insform.Label6.Enabled = True
- Insform.Label7.Enabled = True
- Insform.Label8.Enabled = True
- Insform.Label9.Enabled = True
- Insform.Label10.Enabled = True
- Insform.Label11.Enabled = True
- Insform.Label12.Enabled = True
- Insform.Label13.Enabled = True
- Insform.Label14.Enabled = True
- Insform.Label15.Enabled = True
- Insform.Company.Enabled = True
- Insform.Dept.Enabled = True
- Insform.Division.Enabled = True
- Insform.Address1.Enabled = True
- Insform.Address2.Enabled = True
- Insform.City.Enabled = True
- Insform.State.Enabled = True
- Insform.Zip.Enabled = True
- Insform.Country.Enabled = True
- End If
-
- End Sub
- Private Sub Mr_GotFocus()
- Call SelText(Insform.Mr, 40) 'Call function to Highlight text in this field.
- End Sub
- Private Sub FirstName_GotFocus()
- Call SelText(Insform.FirstName, 40) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Initial_GotFocus()
- Call SelText(Insform.Initial, 2) 'Call function to Highlight text in this field.
- End Sub
- Private Sub LastName_GotFocus()
- Call SelText(Insform.LastName, 60) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Position_GotFocus()
- Call SelText(Insform.Position, 60) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Salutation_GotFocus()
- Call SelText(Insform.Salutation, 40) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Company_GotFocus()
- Call SelText(Insform.Company, 60) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Dept_GotFocus()
- Call SelText(Insform.Dept, 40) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Division_GotFocus()
- Call SelText(Insform.Division, 40) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Address1_GotFocus()
- Call SelText(Insform.Address1, 40) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Address2_GotFocus()
- Call SelText(Insform.Address2, 40) 'Call function to Highlight text in this field.
- End Sub
- Private Sub City_GotFocus()
- Call SelText(Insform.City, 40) 'Call function to Highlight text in this field.
- End Sub
- Private Sub State_GotFocus()
- Call SelText(Insform.State, 40) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Zip_GotFocus()
- Call SelText(Insform.Zip, 20) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Country_GotFocus()
- Call SelText(Insform.Country, 40) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Phone1_GotFocus()
- Call SelText(Insform.Phone1, 22) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Phone2_GotFocus()
- Call SelText(Insform.Phone2, 22) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Phone3_GotFocus()
- Call SelText(Insform.Phone3, 22) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Phone4_GotFocus()
- Call SelText(Insform.Phone4, 22) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Phone1Ext_GotFocus()
- Call SelText(Insform.Phone1Ext, 6) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Phone2Ext_GotFocus()
- Call SelText(Insform.Phone2Ext, 6) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Phone3Ext_GotFocus()
- Call SelText(Insform.Phone3Ext, 6) 'Call function to Highlight text in this field.
- End Sub
- Private Sub Phone4Ext_GotFocus()
- Call SelText(Insform.Phone4Ext, 6) 'Call function to Highlight text in this field.
- End Sub
-