52
DOCUMENTATION OF VISUAL BASIC PROJECT “TELEPHONE DIRECTORY MANAGEMENT” In the partial Fulfillment for the Degree of Bachelor of Business Administration GGS INDRAPRASTHA UNIVERSITY Lingaya’s Lalita Devi Institute of Management And Sciences

Documentation (vb project)

Embed Size (px)

Citation preview

Page 1: Documentation (vb project)

DOCUMENTATION OF VISUAL BASIC PROJECT

“TELEPHONE DIRECTORY MANAGEMENT” In the partial Fulfillment for the Degree of

Bachelor of Business Administration

GGS INDRAPRASTHA UNIVERSITY

Lingaya’s Lalita Devi Institute of ManagementAnd Sciences

DEPARTMENT OF BACHELOR OF BUSINESS ADMINISTRATION

SUBMITTED BY:- ANKUSH GUPTA

(0991921707)

Page 2: Documentation (vb project)

DOCUMENTATION OF VISUAL BASIC PROJECT

““TELEPHONE DIRECTORY MANAGEMENT” In the partial Fulfillment for the Degree of

Bachelor of Business Administration

GGS INDRAPRASTHA UNIVERSITY

Lingaya’s Lalita Devi Institute of ManagementAnd Sciences

DEPARTMENT OF BACHELOR OF BUSINESS ADMINISTRATION

SUBMITTED BY:- DEEPANSHU SHARMA (1011921707)

Page 3: Documentation (vb project)

DOCUMENTATION OF VISUAL BASIC PROJECT

“TELEPHONE DIRECTORY MANAGEMENT” In the partial Fulfillment for the Degree of

Bachelor of Business Administration

GGS INDRAPRASTHA UNIVERSITY

Lingaya’s Lalita Devi Institute of ManagementAnd Sciences

DEPARTMENT OF BACHELOR OF BUSINESS ADMINISTRATION

SUBMITTED BY:- NISHANT BHARDWAJ (1021921707)

Page 4: Documentation (vb project)

DOCUMENTATION OF VISUAL BASIC PROJECT

“TELEPHONE DIRECTORY MANAGEMENT” In the partial Fulfillment for the Degree of

Bachelor of Business Administration

GGS INDRAPRASTHA UNIVERSITY

Lingaya’s Lalita Devi Institute of ManagementAnd Sciences

DEPARTMENT OF BACHELOR OF BUSINESS ADMINISTRATION

SUBMITTED BY:- DEEPAK WALIA

(1031921707)

Page 5: Documentation (vb project)

CONTENTS

Acknowledgement

Abstract

index

Introduction

Software Requirement

General Description

Overall Description

Data Flow Diagram

Flow Chart

Application Form Printouts

Application Coding

Page 6: Documentation (vb project)

ACKNOWLEDGEMENT

We would like to register our heartfelt thanks to Ms.Gayatri for her kind suggestions and invaluable assistance without which our project work would not have completed. We take the opportunity to express our sincere gratitude to Ms. Gayatri for providing invaluable guidance and constant encouragement throughout the project work. We are thankful to her for constructive criticism and valuable suggestions, which benefited us a lot while making this project. Through this column we would like to express our thanks to her for her cooperation and consent without which I might not be able to accomplish this task.

Page 7: Documentation (vb project)

CERTIFICATE

This is to certify that the Dissertation title Telephone directory

management is bonafide & original work done by Nishant bhardwaj

Student of GGSIPU University, under my supervision and guidance.

This Subject on which this dissertation has been done by his original

contribution towards the discipline of computer lab and it has not

previously formed the basis for the award of the Degree, Diploma, or

other similar title to any candidate

This Dissertation represents entirely an independent research work of the

candidate under my guidance.

Signature

Date - ( )

Place - …………………..

Page 8: Documentation (vb project)

CERTIFICATE

This is to certify that the Dissertation title Telephone directory

management is bonafide & original work done by Deepanshu sharma

Student of GGSIPU University, under my supervision and guidance.

This Subject on which this dissertation has been done by his original

contribution towards the discipline of computer lab and it has not

previously formed the basis for the award of the Degree, Diploma, or

other similar title to any candidate

This Dissertation represents entirely an independent research work of the

candidate under my guidance.

Signature

Date - ( )

Place - …………………..

Page 9: Documentation (vb project)

CERTIFICATE

This is to certify that the Dissertation title Telephone directory

management is bonafide & original work done by Ankush Gupta

Student of GGSIPU University, under my supervision and guidance.

This Subject on which this dissertation has been done by his original

contribution towards the discipline of computer lab and it has not

previously formed the basis for the award of the Degree, Diploma, or

other similar title to any candidate

This Dissertation represents entirely an independent research work of the

candidate under my guidance.

Signature

Date - ( )

Place - …………………..

Page 10: Documentation (vb project)

CERTIFICATE

This is to certify that the Dissertation title Telephone directory

management is bonafide & original work done by Deepak Walia Student

of GGSIPU University, under my supervision and guidance.

This Subject on which this dissertation has been done by his original

contribution towards the discipline of computer lab and it has not

previously formed the basis for the award of the Degree, Diploma, or

other similar title to any candidate

This Dissertation represents entirely an independent research work of the

candidate under my guidance.

Signature

Date - ( )

Place - …………………..

Page 11: Documentation (vb project)

ABSTRACT

The project is based on an application which eases the work of directory oriented user work. It contains vast information for the user. The user’s first name, middle name, last name, telephone number, address are contained in it. It can hold indefinite number of user’s information. At any time or at any moment the data related to user can be edited without any haste. Not only that the information can be edited, it is also possible to search any user information by only putting only one of the details. The application is not only user friendly but also good in it resources.

Page 12: Documentation (vb project)

INTRODUCTION

Telephone directory Application is used to manage and search the telephonic details with regard to users name and address. The user can search all recorded details of telephone user. This document is meant to delineate the features of telephone directory application, so as to serve as guidelines to the developers on first hand and the software validation document for the client on the other.

Project Scope:

The telephone directory application is developed for users who wish to access, edit, search or modify the telephonic details of the user by knowing only single thing out of first name, middle name or last name and address of the user about whom the information is to be accessed.

The Application provides functionality on following platforms- Windows XP

Benefits:The benefit of this Telephone directory application is very normal, it can be used anytime when user wants to add, remove, edit, search or modify telephone directory details.

Scope:The scope of this application cannot be considered too wide or too narrow the factor defining its scope is its volume of data storage and as the way to use this application is very easy and understandable therefore anyone can use it without any problem.

Purpose/objectiveThe purpose of this telephone directory application is to add, modify, delete, search telephonic details of the various users and to provide them anytime just by taking any single detail key out of address, phone no., first middle or last name of the telephone user.

Limitations:The only limitation of this application is the feature of taking or say requirement of any single detail key without which no further function can be done in the application.

Page 13: Documentation (vb project)

System testing

System testing of software or hardware is testing conducted on a complete, integrated system to evaluate the system's compliance with its specified requirements. System testing falls within the scope of black box testing, and as such, should require no knowledge of the inner design of the code or logic.

As a rule, system testing takes, as its input, all of the "integrated" software components that have successfully passed integration testing and also the software system itself integrated with any applicable hardware system(s). The purpose of integration testing is to detect any inconsistencies between the software units that are integrated together (called assemblages) or between any of the assemblages and the hardware. System testing is a more limiting type of testing; it seeks to detect defects both within the "inter-assemblages" and also within the system as a whole.

Testing the whole system

System testing is performed on the entire system in the context of a Functional Requirement Specification(s) (FRS) and/or a System Requirement Specification (SRS). System testing is an investigatory testing phase, where the focus is to have almost a destructive attitude[citation needed] and tests not only the design, but also the behavior and even the believed expectations of the customer. It is also intended to test up to and beyond the bounds defined in the software/hardware requirements specification(s)

Page 14: Documentation (vb project)

Types of system testing

The development process involves various types of testing. Each test type addresses a specific testing requirement. The most common types of testing involved in the development process are:

• Unit Test. • Functional Test • Performance Test • System Test • Integration Test • Beta Test • Acceptance Test.

Unit Test

The first test in the development process is the unit test. The source code is normally divided into modules, which in turn are divided into smaller units called units. These units have specific behavior. The test done on these units of code is called unit test. Unit test depends upon the language on which the project is developed. Unit tests ensure that each unique path of the project performs accurately to the documented specifications and contains clearly defined inputs and expected results.

System Test

Several modules constitute a project. If the project is long-term project, several developers write the modules. Once all the modules are integrated, several errors may arise. The testing done at this stage is called system test. System testing ensures that the entire integrated software system meets requirements. It tests a configuration to ensure known and predictable results. System testing is based on process

Page 15: Documentation (vb project)

descriptions and flows, emphasizing pre-driven process links and integration points.

Testing a specific hardware or software installation. This is typically performed on a COTS (commercial off the shelf) system or any other system comprised of disparent parts where custom configurations and/or unique installations are the norm.

Functional Test

Functional test can be defined as testing two or more modules together with the intent of finding defects, demonstrating that defects are not present, verifying that the module performs its intended functions as stated in the specification and establishing confidence that a program does what it is supposed to do.

Acceptance Testing

Testing the system with the intent of confirming readiness of the product and customer acceptance.

Page 16: Documentation (vb project)

1. Systems Development Life Cycle

Model of the Systems Development Life Cycle with the Maintenance bubble highlighted.

The Systems Development Life Cycle (SDLC), or Software Development Life Cycle in systems engineering and software engineering, is the process of creating or altering systems, and the models and methodologies that people use to develop these systems. The concept generally refers to computer or information systems.

In software engineering the SDLC concept underpins many kinds of software development methodologies. These methodologies form the framework for planning and controlling the creation of an information system: the software development process.

Systems Development Life Cycle (SDLC) is any logical process used by a systems analyst to develop an information system, including requirements, validation, training, and user ownership. Any SDLC should result in a high quality system that meets or exceeds customer expectations, reaches completion within time and cost estimates, works effectively and efficiently in the current and planned Information Technology infrastructure, and is inexpensive to maintain and cost-effective to enhance.

Page 17: Documentation (vb project)

Computer systems have become more complex and often (especially with the advent of Service-Oriented Architecture) link multiple traditional systems potentially supplied by different software vendors. To manage this level of complexity, a number of system development life cycle (SDLC) models have been created: "waterfall," "fountain," "spiral," "build and fix," "rapid prototyping," "incremental," and "synchronize and stabilize."

SDLC models can be described along a spectrum of agile to iterative to sequential. Agile methodologies, such as XP and Scrum, focus on light-weight processes which allow for rapid changes along the development cycle. Iterative methodologies, such as Rational Unified Process and Dynamic Systems Development Method, focus on limited project scopes and expanding or improving products by multiple iterations. Sequential or big-design-upfront (BDUF) models, such as Waterfall, focus on complete and correct planning to guide large projects and risks to successful and predictable results.

Some agile and iterative proponents confuse the term SDLC with sequential or "more traditional" processes; however, SDLC is an umbrella term for all methodologies for the design, implementation, and release of software.

In project management a project has both a life cycle and a "systems development life cycle," during which a number of typical activities occur. The project life cycle (PLC) encompasses all the activities of the project, while the systems development life cycle focuses on realizing the product requirements.

Page 18: Documentation (vb project)

SOFTWARE REQUIREMENTS SPECIFICATION

For

Telephone Directory Management

1.1 Glossary:

Term DefinitionM.I Middle name of the telephone user in data.Search Engine Engine used to search telephonic information.Personal information Data including all details of the telephone user.

1.2 References:

Black Book of Visual BasicSoftware Engineering (Galgotia publications)Microsoft Developer’s Network forumwww.a1vbcode.com

2. General Description

Telephone directory is fast software that can be used to access any information recorded in the records of telephone users by any key known it may be user’s first name, last name, middle name or address. Telephone directory creates vast data storage software. You can keep as many as telephone numbers with its user’s details that can be accessed any time. You can store as many telephone numbers with regarding details as you want. Different users can be identified easily with their different middle name or last name as well. Any user can access the application.

Page 19: Documentation (vb project)

3. The Overall Description

Anybody can easily find or access the telephonic details recorded in the directory using any known detail of the telephone user. This application provides a vast recording capacity to store telephonic details with address and other details. When a user wants to use the system he is asked for any of the recorded detail and then they can search full details very comfortably. This application helps the user a lot to draw any information about the telephone user. The interface, which includes simple telephonic details for no reason other than to provide them to you whenever you want, would be better served by a more standard layout that makes options readily and easily available. In our tests, the program demonstrated good speed, even when accessing. If you require these information and need to edit, remove, add or search them, you should definitely give telephone directory a try.

3.1 Product Perspective

This project is independent, unique, and self-contained.

3.2 Product functions

1) Add, remove, edit, save telephonic details.2) Enter the application.3) Search the recorded telephonic details by any single or more known details.

3.3 Operating Environment:

Software Platform:Visual Basic studio 6.0Microsoft Access

3.4 System Requirements

Windows XP

Hardware configurationCORE2DUORam 1GB

Page 20: Documentation (vb project)

Hard diskDATA FLOW DIAGRAMS

0 LEVEL DFD

TELEPHONE USER DETAILS.

ADD, SEARCH, MODIFY, AND EDIT, REMOVE, SAVE TELEPHONE USER DETAILS.

TELEPHONE DIRECTORY.

Page 21: Documentation (vb project)

FORM1 SOFTWARE LAYOUT

Page 22: Documentation (vb project)

FORM 2 (RUNNING MODE)

Page 23: Documentation (vb project)

APPLICATION CODING PRINTOUT

FORM 1 CODING

Option Explicit

Dim vID As String, vLastName As String, vFirstName As String, vMI As String, vHomeAddress As String, vTelNum As String

Private Sub cmdCloseCancel_Click()

If cmdCloseCancel.Caption = "&Close" Then End Else Call Default_Obj End If

End Sub

Private Sub cmdDelete_Click()

Dim vI As Integer If MsgBox("Are you sure you want to delete this entry?", vbQuestion + vbYesNo, "Confirm Delete") = vbYes Then With dtaDB .RecordSource = "SELECT * FROM DirectoryList WHERE ID='" & vID & "'" .Refresh With .Recordset If .BOF = False Then .Delete Call Default_Obj Call Show_Existing("SELECT * FROM DirectoryList") Else: MsgBox "The record you want to delete doesn't exist.", vbExclamation, "Not Found" Exit Sub End If End With End With Else Exit Sub

Page 24: Documentation (vb project)

End If

End Sub

Private Sub cmdEditUpdate_Click()

If cmdEditUpdate.Caption = "&Edit" Then cmdEditUpdate.Caption = "&Update" fraSearch.Enabled = False fraInfo.Enabled = True cmdCloseCancel.Caption = "&Cancel" vLastName = txtLastName vFirstName = txtFirstName vMI = txtMI vHomeAddress = txtHomeAddress vTelNum = txtTelNum txtLastName.SetFocus SendKeys "{HOME}+{END}" Else If Len(txtLastName) = 0 Then MsgBox "Full Name Textbox contains do data.", vbExclamation, "Empty Textbox" txtLastName.SetFocus Exit Sub End If If Len(txtFirstName) = 0 Then MsgBox "Full Name Textbox contains do data.", vbExclamation, "Empty Textbox" txtFirstName.SetFocus Exit Sub End If If Len(txtMI) = 0 Then MsgBox "Middle Initial Textbox contains do data.", vbExclamation, "Empty Textbox" txtLastName.SetFocus Exit Sub End If If Len(txtHomeAddress) = 0 Then MsgBox "Home Address Textbox contains do data.", vbExclamation, "Empty Textbox" txtHomeAddress.SetFocus Exit Sub End If If Len(txtTelNum) = 0 Then MsgBox "Telephone # Textbox contains do data.", vbExclamation, "Empty Textbox" txtTelNum.SetFocus Exit Sub End If

Page 25: Documentation (vb project)

If vLastName = txtLastName And vFirstName = txtFirstName And vMI = txtMI And vHomeAddress = txtHomeAddress And vTelNum = txtTelNum Then MsgBox "No changes was made in this record.", vbInformation, "Update Record" Call Default_Obj Exit Sub Else With dtaDB .RecordSource = "SELECT * FROM DirectoryList WHERE LastName='" & txtLastName & "' AND FirstName='" & txtFirstName & "' AND MI='" & txtMI & "' AND Address='" & txtHomeAddress & "' AND TelNum ='" & txtTelNum & "'" .Refresh With .Recordset If .BOF = True Then GoTo EditUpdate_Record Else MsgBox "This entry already exist.", vbExclamation, "Duplicate Entry" txtLastName.SetFocus SendKeys "{HOME}+{END}" Exit Sub End If End With End With End If End If Exit Sub EditUpdate_Record: With dtaDB .RecordSource = "SELECT * FROM DirectoryList WHERE ID='" & vID & "'" .Refresh With .Recordset If .BOF = True Then MsgBox "The record you want to edit/update doesn't exist.", vbExclamation, "Not Found" Exit Sub Else .Edit !LastName = txtLastName !FirstName = txtFirstName !Mi = txtMI !TelNum = txtTelNum !Address = txtHomeAddress .Update Call Default_Obj Call Show_Existing("SELECT * FROM DirectoryList") End If

Page 26: Documentation (vb project)

End With End With

End Sub

Private Sub cmdNewSave_Click()

If cmdNewSave.Caption = "&New" Then Call Default_Obj cmdNewSave.Caption = "&Save" fraSearch.Enabled = False fraInfo.Enabled = True cmdNewSave.Caption = "&Save" cmdCloseCancel.Caption = "&Cancel" txtLastName.SetFocus Else If Len(txtLastName) = 0 Then MsgBox "Full Name Textbox contains do data.", vbExclamation, "Empty Textbox" txtLastName.SetFocus Exit Sub End If If Len(txtFirstName) = 0 Then MsgBox "Full Name Textbox contains do data.", vbExclamation, "Empty Textbox" txtFirstName.SetFocus Exit Sub End If If Len(txtMI) = 0 Then MsgBox "Middle Initial Textbox contains do data.", vbExclamation, "Empty Textbox" txtLastName.SetFocus Exit Sub End If If Len(txtHomeAddress) = 0 Then MsgBox "Home Address Textbox contains do data.", vbExclamation, "Empty Textbox" txtHomeAddress.SetFocus Exit Sub End If If Len(txtTelNum) = 0 Then MsgBox "Telephone # Textbox contains do data.", vbExclamation, "Empty Textbox" txtTelNum.SetFocus Exit Sub End If With dtaDB .RecordSource = "SELECT * FROM DirectoryList WHERE LastName='" & txtLastName & "' AND FirstName='" & txtFirstName & "' AND MI='" & txtMI & "' AND Address='" & txtHomeAddress & "' AND TelNum ='" & txtTelNum & "'"

Page 27: Documentation (vb project)

.Refresh With .Recordset If .BOF = True Then .AddNew !ID = Format(Date, "mmddyy") & Format(Time, "hhmmss") !LastName = txtLastName !FirstName = txtFirstName !Mi = txtMI !TelNum = txtTelNum !Address = txtHomeAddress .Update Call Show_Existing("SELECT * FROM DirectoryList") MsgBox "New entry was successfully addedd.", vbInformation, "Record Saved" Call Default_Obj Exit Sub Else MsgBox "This entry already exist.", vbExclamation, "Duplicate Entry" txtLastName.SetFocus SendKeys "{HOME}+{END}" Exit Sub End If End With End With End If

End Sub

Private Sub Form_Load()

dtaDB.DatabaseName = App.Path & "\TelDir.mdb" Call Default_Obj Call Show_Existing("SELECT * FROM DirectoryList")

End Sub

Private Sub Default_Obj()

With Me .txtLastName = "" .txtFirstName = "" .txtMI = "" .txtHomeAddress = "" .txtSearchKey = "" .txtTelNum = "" .cboSearchBy.Text = .cboSearchBy.List(0) .cmdCloseCancel.Caption = "&Close"

Page 28: Documentation (vb project)

.cmdDelete.Enabled = False .cmdEditUpdate.Caption = "&Edit" .cmdEditUpdate.Enabled = False .cmdNewSave.Caption = "&New" .fraInfo.Enabled = False .fraSearch.Enabled = True End With

End Sub

Private Sub Show_Existing(vSQL As String)

Dim vLst As ListItem

lstExisting.ListItems.Clear With dtaDB .RecordSource = vSQL .Refresh With .Recordset If .BOF = True Then Exit Sub .MoveFirst While Not .EOF Set vLst = lstExisting.ListItems.Add(, , !ID) vLst.SubItems(1) = !LastName vLst.SubItems(2) = !FirstName vLst.SubItems(3) = !Mi vLst.SubItems(4) = !Address vLst.SubItems(5) = !TelNum .MoveNext Wend End With End With lblCnt = "# of Records : " & lstExisting.ListItems.Count lstExisting.Refresh lstExisting.Refresh

End Sub

Private Sub lstExisting_Click()

Dim vI As Integer If lstExisting.ListItems.Count = 0 Then Exit Sub

Page 29: Documentation (vb project)

Call Default_Obj cmdEditUpdate.Enabled = True cmdDelete.Enabled = True vI = lstExisting.SelectedItem.Index vID = lstExisting.SelectedItem txtLastName = lstExisting.ListItems(vI).ListSubItems(1) txtFirstName = lstExisting.ListItems(vI).ListSubItems(2) txtMI = lstExisting.ListItems(vI).ListSubItems(3) txtHomeAddress = lstExisting.ListItems(vI).ListSubItems(4) txtTelNum = lstExisting.ListItems(vI).ListSubItems(5)

End Sub

Private Sub txtSearchKey_Change()

Dim vSQL As String

Select Case cboSearchBy.Text Case "Last Name" vSQL = "SELECT * FROM DirectoryList WHERE LastName LIKE '" & txtSearchKey & "*'" Case "First Name" vSQL = "SELECT * FROM DirectoryList WHERE FirstName LIKE '" & txtSearchKey & "*'" Case "M.I." vSQL = "SELECT * FROM DirectoryList WHERE MI LIKE '" & txtSearchKey & "*'" Case "Home Address" vSQL = "SELECT * FROM DirectoryList WHERE Address LIKE '" & txtSearchKey & "*'" Case "Telephone #" vSQL = "SELECT * FROM DirectoryList WHERE TelNum LIKE '" & txtSearchKey & "*'" End Select Call Show_Existing(vSQL)

End Sub

Page 30: Documentation (vb project)

FORM 2 CODING

Option Explicit

Dim vID As String, vLastName As String, vFirstName As String, vMI As String, vHomeAddress As String, vTelNum As String

Private Sub cmdCloseCancel_Click()

If cmdCloseCancel.Caption = "&Close" Then End Else Call Default_Obj End If

End Sub

Private Sub cmdDelete_Click()

Dim vI As Integer

If MsgBox("Are you sure you want to delete this entry?", vbQuestion + vbYesNo, "Confirm Delete") = vbYes Then With dtaDB .RecordSource = "SELECT * FROM DirectoryList WHERE ID='" & vID & "'" .Refresh With .Recordset If .BOF = False Then .Delete Call Default_Obj Call Show_Existing("SELECT * FROM DirectoryList") Else MsgBox "The record you want to delete doesn't exist.", vbExclamation, "Not Found" Exit Sub End If End With End With Else Exit Sub

Page 31: Documentation (vb project)

End If

End Sub

Private Sub cmdEditUpdate_Click()

If cmdEditUpdate.Caption = "&Edit" Then cmdEditUpdate.Caption = "&Update" fraSearch.Enabled = False fraInfo.Enabled = True cmdCloseCancel.Caption = "&Cancel" vLastName = txtLastName vFirstName = txtFirstName vMI = txtMI vHomeAddress = txtHomeAddress vTelNum = txtTelNum txtLastName.SetFocus SendKeys "{HOME}+{END}" Else If Len(txtLastName) = 0 Then MsgBox "Full Name Textbox contains do data.", vbExclamation, "Empty Textbox" txtLastName.SetFocus Exit Sub End If If Len(txtFirstName) = 0 Then MsgBox "Full Name Textbox contains do data.", vbExclamation, "Empty Textbox" txtFirstName.SetFocus Exit Sub End If If Len(txtMI) = 0 Then MsgBox "Middle Initial Textbox contains do data.", vbExclamation, "Empty Textbox" txtLastName.SetFocus Exit Sub End If If Len(txtHomeAddress) = 0 Then MsgBox "Home Address Textbox contains do data.", vbExclamation, "Empty Textbox" txtHomeAddress.SetFocus Exit Sub End If If Len(txtTelNum) = 0 Then MsgBox "Telephone # Textbox contains do data.", vbExclamation, "Empty Textbox" txtTelNum.SetFocus Exit Sub End If

Page 32: Documentation (vb project)

If vLastName = txtLastName And vFirstName = txtFirstName And vMI = txtMI And vHomeAddress = txtHomeAddress And vTelNum = txtTelNum Then MsgBox "No changes was made in this record.", vbInformation, "Update Record" Call Default_Obj Exit Sub Else With dtaDB .RecordSource = "SELECT * FROM DirectoryList WHERE LastName='" & txtLastName & "' AND FirstName='" & txtFirstName & "' AND MI='" & txtMI & "' AND Address='" & txtHomeAddress & "' AND TelNum ='" & txtTelNum & "'" .Refresh With .Recordset If .BOF = True Then GoTo EditUpdate_Record Else MsgBox "This entry already exist.", vbExclamation, "Duplicate Entry" txtLastName.SetFocus SendKeys "{HOME}+{END}" Exit Sub End If End With End With End If End If Exit Sub EditUpdate_Record: With dtaDB .RecordSource = "SELECT * FROM DirectoryList WHERE ID='" & vID & "'" .Refresh With .Recordset If .BOF = True Then MsgBox "The record you want to edit/update doesn't exist.", vbExclamation, "Not Found" Exit Sub Else .Edit !LastName = txtLastName !FirstName = txtFirstName !Mi = txtMI !TelNum = txtTelNum !Address = txtHomeAddress .Update Call Default_Obj Call Show_Existing("SELECT * FROM DirectoryList") End If

Page 33: Documentation (vb project)

End With End With

End Sub

Private Sub cmdNewSave_Click()

If cmdNewSave.Caption = "&New" Then Call Default_Obj cmdNewSave.Caption = "&Save" fraSearch.Enabled = False fraInfo.Enabled = True cmdNewSave.Caption = "&Save" cmdCloseCancel.Caption = "&Cancel" txtLastName.SetFocus Else If Len(txtLastName) = 0 Then MsgBox "Full Name Textbox contains do data.", vbExclamation, "Empty Textbox" txtLastName.SetFocus Exit Sub End If If Len(txtFirstName) = 0 Then MsgBox "Full Name Textbox contains do data.", vbExclamation, "Empty Textbox" txtFirstName.SetFocus Exit Sub End If If Len(txtMI) = 0 Then MsgBox "Middle Initial Textbox contains do data.", vbExclamation, "Empty Textbox" txtLastName.SetFocus Exit Sub End If If Len(txtHomeAddress) = 0 Then MsgBox "Home Address Textbox contains do data.", vbExclamation, "Empty Textbox" txtHomeAddress.SetFocus Exit Sub End If If Len(txtTelNum) = 0 Then MsgBox "Telephone # Textbox contains do data.", vbExclamation, "Empty Textbox" txtTelNum.SetFocus Exit Sub End If With dtaDB .RecordSource = "SELECT * FROM DirectoryList WHERE LastName='" & txtLastName & "' AND FirstName='" & txtFirstName & "' AND MI='" & txtMI & "' AND Address='" & txtHomeAddress & "' AND TelNum ='" & txtTelNum & "'"

Page 34: Documentation (vb project)

.Refresh With .Recordset If .BOF = True Then .AddNew !ID = Format(Date, "mmddyy") & Format(Time, "hhmmss") !LastName = txtLastName !FirstName = txtFirstName !Mi = txtMI !TelNum = txtTelNum !Address = txtHomeAddress .Update Call Show_Existing("SELECT * FROM DirectoryList") MsgBox "New entry was successfully addedd.", vbInformation, "Record Saved" Call Default_Obj Exit Sub Else MsgBox "This entry already exist.", vbExclamation, "Duplicate Entry" txtLastName.SetFocus SendKeys "{HOME}+{END}" Exit Sub End If End With End With End If

End Sub

Private Sub Form_Load()

dtaDB.DatabaseName = App.Path & "\TelDir.mdb" Call Default_Obj Call Show_Existing("SELECT * FROM DirectoryList")

End Sub

Private Sub Default_Obj()

With Me .txtLastName = "" .txtFirstName = "" .txtMI = "" .txtHomeAddress = "" .txtSearchKey = "" .txtTelNum = "" .cboSearchBy.Text = .cboSearchBy.List(0) .cmdCloseCancel.Caption = "&Close"

Page 35: Documentation (vb project)

.cmdDelete.Enabled = False .cmdEditUpdate.Caption = "&Edit" .cmdEditUpdate.Enabled = False .cmdNewSave.Caption = "&New" .fraInfo.Enabled = False .fraSearch.Enabled = True End With

End Sub

Private Sub Show_Existing(vSQL As String)

Dim vLst As ListItem

lstExisting.ListItems.Clear With dtaDB .RecordSource = vSQL .Refresh With .Recordset If .BOF = True Then Exit Sub .MoveFirst While Not .EOF Set vLst = lstExisting.ListItems.Add(, , !ID) vLst.SubItems(1) = !LastName vLst.SubItems(2) = !FirstName vLst.SubItems(3) = !Mi vLst.SubItems(4) = !Address vLst.SubItems(5) = !TelNum .MoveNext Wend End With End With lblCnt = "# of Records : " & lstExisting.ListItems.Count lstExisting.Refresh lstExisting.Refresh

End Sub

Private Sub lstExisting_Click()

Dim vI As Integer If lstExisting.ListItems.Count = 0 Then Exit Sub

Page 36: Documentation (vb project)

Call Default_Obj cmdEditUpdate.Enabled = True cmdDelete.Enabled = True vI = lstExisting.SelectedItem.Index vID = lstExisting.SelectedItem txtLastName = lstExisting.ListItems(vI).ListSubItems(1) txtFirstName = lstExisting.ListItems(vI).ListSubItems(2) txtMI = lstExisting.ListItems(vI).ListSubItems(3) txtHomeAddress = lstExisting.ListItems(vI).ListSubItems(4) txtTelNum = lstExisting.ListItems(vI).ListSubItems(5)

End Sub

Private Sub txtSearchKey_Change()

Dim vSQL As String

Select Case cboSearchBy.Text Case "Last Name" vSQL = "SELECT * FROM DirectoryList WHERE LastName LIKE '" & txtSearchKey & "*'" Case "First Name" vSQL = "SELECT * FROM DirectoryList WHERE FirstName LIKE '" & txtSearchKey & "*'" Case "M.I." vSQL = "SELECT * FROM DirectoryList WHERE MI LIKE '" & txtSearchKey & "*'" Case "Home Address" vSQL = "SELECT * FROM DirectoryList WHERE Address LIKE '" & txtSearchKey & "*'" Case "Telephone #" vSQL = "SELECT * FROM DirectoryList WHERE TelNum LIKE '" & txtSearchKey & "*'" End Select Call Show_Existing(vSQL)

End Sub

Page 37: Documentation (vb project)

THE DATABASE

Page 38: Documentation (vb project)