28749107 documentation vb project
TRANSCRIPT
-
7/27/2019 28749107 Documentation Vb Project
1/36
DOCUMENTATION OF VISUAL BASIC PROJECT
TELEPHONE DIRECTORY MANAGEMENT
In the partial Fulfillment for the Degree of
Bachelor of Business Administration
CHANDER PRABHU JAIN COLLEGE OF HIGHER STUDIES
AFFILATED TO
GURU GOVIND SINGH INDRAPRASTHA UNIVERSITY
DEPARTMENT OF BACHELOR OF BUSINESS
ADMINISTRATION
SUBMITTED BY:- PRIYAVANSH SINGH
BBA (Gen) 5th SEM
1672151708
-
7/27/2019 28749107 Documentation Vb Project
2/36
ACKNOWLEDGEMENT
We would like to register our heartfelt thanks to Ms. 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. 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.
PRIYAVANSH SINGH
-
7/27/2019 28749107 Documentation Vb Project
3/36
CERTIFICATE
This is to certify that the Dissertation title Telephone directory
management is bonafide & original work done by Priyavansh Singh
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 - ..
-
7/27/2019 28749107 Documentation Vb Project
4/36
CONTENTS
Acknowledgement
Abstract
index
Introduction
Software Requirement
General Description
Overall Description
Data Flow Diagram
Flow Chart
Application Form Printouts
Application Coding
-
7/27/2019 28749107 Documentation Vb Project
5/36
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 users first name, middle name, last name, telephone number,
address are contained in it. It can hold indefinite number of users
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.
-
7/27/2019 28749107 Documentation Vb Project
6/36
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.
-
7/27/2019 28749107 Documentation Vb Project
7/36
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/objective
The 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.
-
7/27/2019 28749107 Documentation Vb Project
8/36
Limitations:
The only limitation of this application is the feature of taking or say
requirement of any single detail key without which no further functioncan be done in the application.
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
-
7/27/2019 28749107 Documentation Vb Project
9/36
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)
-
7/27/2019 28749107 Documentation Vb Project
10/36
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
-
7/27/2019 28749107 Documentation Vb Project
11/36
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
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.
-
7/27/2019 28749107 Documentation Vb Project
12/36
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.
http://en.wikipedia.org/wiki/File:SDLC-Maintenance-Highlighted.png -
7/27/2019 28749107 Documentation Vb Project
13/36
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.
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 andDynamic 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
-
7/27/2019 28749107 Documentation Vb Project
14/36
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.
-
7/27/2019 28749107 Documentation Vb Project
15/36
SOFTWARE REQUIREMENTS
SPECIFICATION
For
Telephone Directory Management
1.1 Glossary:
Term Definition
M.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.
References:
Black Book of Visual Basic
Software Engineering (Galgotia publications)
Microsoft Developers Network forum
www.a1vbcode.com
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 users 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 users
details that can be accessed any time. You can store as many telephone numbers
-
7/27/2019 28749107 Documentation Vb Project
16/36
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.
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 thenthey 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.
1.2 Product Perspective
This project is independent, unique, and self-contained.
1.3 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.
-
7/27/2019 28749107 Documentation Vb Project
17/36
1.4 Operating Environment:
Software Platform:
Visual Basic studio 6.0
Microsoft Access
1.5 System Requirements
Windows XP
Hardware configuration
CORE2DUO
Ram 1GB
Hard disk
DATA FLOW DIAGRAMS
0 LEVEL DFD
TELEPHONE
USER
DETAILS.
ADD,
SEARCH,MODIFY,
AND EDIT,
REMOVE,SAVE
TELEPHONE
USERDETAILS.
TELEPHONE
DIRECTORY.
-
7/27/2019 28749107 Documentation Vb Project
18/36
FORM1 SOFTWARE LAYOUT
-
7/27/2019 28749107 Documentation Vb Project
19/36
FORM 2 (RUNNING MODE)
-
7/27/2019 28749107 Documentation Vb Project
20/36
APPLICATION CODING PRINTOUT
-
7/27/2019 28749107 Documentation Vb Project
21/36
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 ThenWith dtaDB
.RecordSource = "SELECT * FROM DirectoryList WHERE ID='" & vID & "'"
.RefreshWith .Recordset
If .BOF = False Then
.Delete
Call Default_ObjCall 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 WithElse
Exit Sub
End If
End Sub
Private Sub cmdEditUpdate_Click()
-
7/27/2019 28749107 Documentation Vb Project
22/36
If cmdEditUpdate.Caption = "&Edit" Then
cmdEditUpdate.Caption = "&Update"fraSearch.Enabled = False
fraInfo.Enabled = True
cmdCloseCancel.Caption = "&Cancel"vLastName = txtLastName
vFirstName = txtFirstName
vMI = txtMIvHomeAddress = 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.SetFocusExit Sub
End IfIf Len(txtFirstName) = 0 Then
MsgBox "Full Name Textbox contains do data.", vbExclamation, "Empty Textbox"
txtFirstName.SetFocusExit Sub
End If
If Len(txtMI) = 0 Then
MsgBox "Middle Initial Textbox contains do data.", vbExclamation, "Empty Textbox"txtLastName.SetFocus
Exit Sub
End IfIf Len(txtHomeAddress) = 0 Then
MsgBox "Home Address Textbox contains do data.", vbExclamation, "Empty Textbox"
txtHomeAddress.SetFocusExit Sub
End If
If Len(txtTelNum) = 0 Then
MsgBox "Telephone # Textbox contains do data.", vbExclamation, "Empty Textbox"txtTelNum.SetFocus
Exit Sub
End If
If vLastName = txtLastName And vFirstName = txtFirstName And vMI = txtMI And
vHomeAddress = txtHomeAddress And vTelNum = txtTelNum ThenMsgBox "No changes was made in this record.", vbInformation, "Update Record"
Call Default_Obj
Exit Sub
Else
-
7/27/2019 28749107 Documentation Vb Project
23/36
With dtaDB
.RecordSource = "SELECT * FROM DirectoryList WHERE LastName='" &
txtLastName & "' AND FirstName='" & txtFirstName & "' AND MI='" & txtMI & "' ANDAddress='" & txtHomeAddress & "' AND TelNum ='" & txtTelNum & "'"
.Refresh
With .RecordsetIf .BOF = True Then
GoTo EditUpdate_Record
ElseMsgBox "This entry already exist.", vbExclamation, "Duplicate Entry"
txtLastName.SetFocus
SendKeys "{HOME}+{END}"
Exit SubEnd If
End With
End With
End IfEnd If
Exit Sub
EditUpdate_Record:
With dtaDB.RecordSource = "SELECT * FROM DirectoryList WHERE ID='" & vID & "'"
.Refresh
With .Recordset
If .BOF = True ThenMsgBox "The record you want to edit/update doesn't exist.", vbExclamation, "Not
Found"
Exit SubElse
.Edit
!LastName = txtLastName!FirstName = txtFirstName
!Mi = txtMI
!TelNum = txtTelNum
!Address = txtHomeAddress.Update
Call Default_Obj
Call Show_Existing("SELECT * FROM DirectoryList")End If
End With
End With
End Sub
-
7/27/2019 28749107 Documentation Vb Project
24/36
Private Sub cmdNewSave_Click()
If cmdNewSave.Caption = "&New" ThenCall Default_Obj
cmdNewSave.Caption = "&Save"
fraSearch.Enabled = FalsefraInfo.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 ThenMsgBox "Full Name Textbox contains do data.", vbExclamation, "Empty Textbox"
txtFirstName.SetFocusExit Sub
End If
If Len(txtMI) = 0 ThenMsgBox "Middle Initial Textbox contains do data.", vbExclamation, "Empty Textbox"
txtLastName.SetFocus
Exit Sub
End IfIf Len(txtHomeAddress) = 0 Then
MsgBox "Home Address Textbox contains do data.", vbExclamation, "Empty Textbox"
txtHomeAddress.SetFocusExit Sub
End If
If Len(txtTelNum) = 0 ThenMsgBox "Telephone # Textbox contains do data.", vbExclamation, "Empty Textbox"
txtTelNum.SetFocus
Exit Sub
End IfWith dtaDB
.RecordSource = "SELECT * FROM DirectoryList WHERE LastName='" &
txtLastName & "' AND FirstName='" & txtFirstName & "' AND MI='" & txtMI & "' ANDAddress='" & txtHomeAddress & "' AND TelNum ='" & txtTelNum & "'"
.Refresh
With .RecordsetIf .BOF = True Then
.AddNew
!ID = Format(Date, "mmddyy") & Format(Time, "hhmmss")
!LastName = txtLastName
-
7/27/2019 28749107 Documentation Vb Project
25/36
!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 SubElse
MsgBox "This entry already exist.", vbExclamation, "Duplicate Entry"
txtLastName.SetFocus
SendKeys "{HOME}+{END}"Exit Sub
End If
End With
End WithEnd 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"
.cmdDelete.Enabled = False
.cmdEditUpdate.Caption = "&Edit"
.cmdEditUpdate.Enabled = False
.cmdNewSave.Caption = "&New"
.fraInfo.Enabled = False
.fraSearch.Enabled = True
-
7/27/2019 28749107 Documentation Vb Project
26/36
End With
End Sub
Private Sub Show_Existing(vSQL As String)
Dim vLst As ListItem
lstExisting.ListItems.Clear
With dtaDB
.RecordSource = vSQL
.RefreshWith .Recordset
If .BOF = True Then Exit Sub
.MoveFirst
While Not .EOFSet vLst = lstExisting.ListItems.Add(, , !ID)
vLst.SubItems(1) = !LastNamevLst.SubItems(2) = !FirstName
vLst.SubItems(3) = !Mi
vLst.SubItems(4) = !AddressvLst.SubItems(5) = !TelNum
.MoveNext
Wend
End WithEnd With
lblCnt = "# of Records : " & lstExisting.ListItems.CountlstExisting.Refresh
lstExisting.Refresh
End Sub
Private Sub lstExisting_Click()
Dim vI As Integer
If lstExisting.ListItems.Count = 0 Then Exit Sub
Call Default_Obj
cmdEditUpdate.Enabled = True
cmdDelete.Enabled = True
vI = lstExisting.SelectedItem.Index
-
7/27/2019 28749107 Documentation Vb Project
27/36
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
FORM 2 CODING
-
7/27/2019 28749107 Documentation Vb Project
28/36
-
7/27/2019 28749107 Documentation Vb Project
29/36
cmdEditUpdate.Caption = "&Update"
fraSearch.Enabled = False
fraInfo.Enabled = TruecmdCloseCancel.Caption = "&Cancel"
vLastName = txtLastName
vFirstName = txtFirstNamevMI = txtMI
vHomeAddress = txtHomeAddress
vTelNum = txtTelNumtxtLastName.SetFocus
SendKeys "{HOME}+{END}"
Else
If Len(txtLastName) = 0 ThenMsgBox "Full Name Textbox contains do data.", vbExclamation, "Empty Textbox"
txtLastName.SetFocus
Exit Sub
End IfIf Len(txtFirstName) = 0 Then
MsgBox "Full Name Textbox contains do data.", vbExclamation, "Empty Textbox"txtFirstName.SetFocus
Exit Sub
End IfIf Len(txtMI) = 0 Then
MsgBox "Middle Initial Textbox contains do data.", vbExclamation, "Empty Textbox"
txtLastName.SetFocus
Exit SubEnd If
If Len(txtHomeAddress) = 0 Then
MsgBox "Home Address Textbox contains do data.", vbExclamation, "Empty Textbox"txtHomeAddress.SetFocus
Exit Sub
End IfIf Len(txtTelNum) = 0 Then
MsgBox "Telephone # Textbox contains do data.", vbExclamation, "Empty Textbox"
txtTelNum.SetFocus
Exit SubEnd If
If vLastName = txtLastName And vFirstName = txtFirstName And vMI = txtMI AndvHomeAddress = txtHomeAddress And vTelNum = txtTelNum Then
MsgBox "No changes was made in this record.", vbInformation, "Update Record"
Call Default_ObjExit Sub
Else
With dtaDB
-
7/27/2019 28749107 Documentation Vb Project
30/36
.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 ThenGoTo EditUpdate_Record
Else
MsgBox "This entry already exist.", vbExclamation, "Duplicate Entry"txtLastName.SetFocus
SendKeys "{HOME}+{END}"
Exit Sub
End IfEnd With
End With
End If
End IfExit 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, "NotFound"
Exit Sub
Else.Edit
!LastName = txtLastName
!FirstName = txtFirstName!Mi = txtMI
!TelNum = txtTelNum
!Address = txtHomeAddress
.UpdateCall Default_Obj
Call Show_Existing("SELECT * FROM DirectoryList")
End IfEnd With
End With
End Sub
Private Sub cmdNewSave_Click()
-
7/27/2019 28749107 Documentation Vb Project
31/36
If cmdNewSave.Caption = "&New" Then
Call Default_ObjcmdNewSave.Caption = "&Save"
fraSearch.Enabled = False
fraInfo.Enabled = TruecmdNewSave.Caption = "&Save"
cmdCloseCancel.Caption = "&Cancel"
txtLastName.SetFocusElse
If Len(txtLastName) = 0 Then
MsgBox "Full Name Textbox contains do data.", vbExclamation, "Empty Textbox"
txtLastName.SetFocusExit Sub
End If
If Len(txtFirstName) = 0 Then
MsgBox "Full Name Textbox contains do data.", vbExclamation, "Empty Textbox"txtFirstName.SetFocus
Exit SubEnd 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 ThenMsgBox "Home Address Textbox contains do data.", vbExclamation, "Empty Textbox"
txtHomeAddress.SetFocus
Exit SubEnd 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 & "'".Refresh
With .Recordset
If .BOF = True Then.AddNew
!ID = Format(Date, "mmddyy") & Format(Time, "hhmmss")
!LastName = txtLastName
!FirstName = txtFirstName
-
7/27/2019 28749107 Documentation Vb Project
32/36
!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
ElseMsgBox "This entry already exist.", vbExclamation, "Duplicate Entry"
txtLastName.SetFocus
SendKeys "{HOME}+{END}"
Exit SubEnd 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"
.cmdDelete.Enabled = False
.cmdEditUpdate.Caption = "&Edit"
.cmdEditUpdate.Enabled = False
.cmdNewSave.Caption = "&New"
.fraInfo.Enabled = False
.fraSearch.Enabled = True
End With
-
7/27/2019 28749107 Documentation Vb Project
33/36
End Sub
Private Sub Show_Existing(vSQL As String)
Dim vLst As ListItem
lstExisting.ListItems.ClearWith dtaDB
.RecordSource = vSQL
.Refresh
With .RecordsetIf .BOF = True Then Exit Sub
.MoveFirst
While Not .EOF
Set vLst = lstExisting.ListItems.Add(, , !ID)vLst.SubItems(1) = !LastName
vLst.SubItems(2) = !FirstNamevLst.SubItems(3) = !Mi
vLst.SubItems(4) = !Address
vLst.SubItems(5) = !TelNum.MoveNext
Wend
End With
End With
lblCnt = "# of Records : " & lstExisting.ListItems.Count
lstExisting.RefreshlstExisting.Refresh
End Sub
Private Sub lstExisting_Click()
Dim vI As Integer
If lstExisting.ListItems.Count = 0 Then Exit Sub
Call Default_Obj
cmdEditUpdate.Enabled = TruecmdDelete.Enabled = True
vI = lstExisting.SelectedItem.Index
vID = lstExisting.SelectedItem
-
7/27/2019 28749107 Documentation Vb Project
34/36
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
THE DATABASE
-
7/27/2019 28749107 Documentation Vb Project
35/36
-
7/27/2019 28749107 Documentation Vb Project
36/36