Вы находитесь на странице: 1из 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Submitted At: Mehr Chand Polytechnic To Mr.Prince Madaan H.O.D Of Computer Dept. Submitted By: Mind Breakers Team Roll No.552,508,536,550/07 CSE III Yr
Mind Breakers Page 1 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

SR. No NO.
3.
4.

TOPICS

PAGE
3 4 5 6 (7-11) 8 9 10 12 (13-19) 14 15 18 19 (20-82) 21 23 24 33 39 47 50 54 66 69 71
Page 2 of 84

5. 6. 7. 8. 9. 10. 11. 12. 13. 14.


15.

16. 17. 18. 19.


20. 21. 22. 23. 24. 25.

26.

1. CERTIFICATE 2. ACKNOWLEDGEMENT SYNOPSIS SOFTWARE USED(A BRIEF INTRODUCTION) ABOUT VISUAL BASIC VERSION & FEATURES EDITIONS OF VISUAL BASIC 6.0 VISUAL BASIC PHILOSOPHY ABOUT MS-ACCESS ABOUT TELEPHONE DIARY AN INTRODUCTION FEATURES OBJECTIVES OF PROJECT SYSTEM REQUIREMENTS WINDOWS & CODING THE LOGIN WINDOW THE SPLASH SCREEN MDI FORM SIMPLE SEARCH WINDOW ADVANCE SEARCH WINDOW ISD CODES STD CODES DATABASE WINDOW SHOW ALL RECORDS ADD NEW ISD CODE ADD NEW STD CODE

Mind Breakers

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

OTHER FORMS 28. ABOUT ME WINDOW 29. BIBLIOGRAPHY


27.

73-81 82 83

Mind Breakers

Page 3 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

This is certified that Project titled Telephone Diary has been successfully completed by Mind Breakers Roll No. 552,508,536,550/07 of CSE-III Year from Mehr Chand Polytechnic College and submitted in partial fulfillment of requirement for the Computer Science under my guidance and has been found quite worthy of appearance.

Guided and Checked By: Mr . Prince Madaan H.O.D Of Computer Dept.

Mind Breakers

Page 4 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

It is with pleasure that I find myself penning down these lines to express my sincere thanks to various people to help me along the way in completing this work. This harmonious climate in our department provided the proper academic setting due in great measure to the intelligent and able leadership of our sir Mr. Jitender Kumar Anand I express my gratitude to him. I am also thankful to other staff members and my Friends for their kind guidance. Last but not least I am thankful to GOD with whose grace I completed our project.

Mind Breakers .

Mind Breakers

Page 5 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

We are crossing the threshold of a new information era in which we are developing tools that permit us to amplify human intelligence and acquire the information needed to explore new systems of health care, education, science, manufacturing, communication and business. The new information era is nothing but the Computer era. Computers are the greatest achievement of out time. Computers have infiltrated in most of the activities around us. They are increasingly becoming the backbone of our information system and are improving our information system and are improving our industrial efficiency and optimal operation. The project work on Telephone Diary helps us keep complete information about any persons. It is worked out with the elegance of the Visual Basic6.0 on the front hand and Microsofts MS Access on the backhand to handle database.

Mind Breakers

Page 6 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

A REIF INTRODUCTION: (i) Visual Basic:


Visual Basic is a Window programming language that has been developed at Microsoft Corporation. Visual Basic is a powerful programming language to develop sophisticated windows programs very quickly. Visual Basic is one of the Rapid Application Development tools as it enables the programmer to develop application very easily and very quickly. It contains the same BASIC like language that has been popular over the years and it includes all the necessary extension required to produse Window programs.

(ii) Ms-Access:
Microsofts Access comes under the software package Microsofts Office. It was first introduced as a part of Office95, then Office97, Office2000 and now as a part of Office XP. In the project I have used MS Access from Office Xp. The main purpose of the package is to handle the database for insertion, deletion, updating and storage.

(iii)Adobe-Photoshop:
Adobe-Photoshop is advance package for editing the pictures of all kind of formats like .BMP, .JPEG etc; in this project Photoshop is used for editing icons and pictures used in project.

Mind Breakers

Page 7 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Visual Basic is an event driven programming. The Visual part refers to the method used to create the graphical interface (GUI). Rather than writing numerous lines of code to describe the location and appearance of interface elements, we simply drag and drop pre-build objects into place on the screen. The advantage of such an approach was that there were very fewer bugs and lesser surprises. Building prototypes became very easy once the interface was developed, the programmers had ton fill in the relevant functions and collect the checks. The Basic part refers to the BASIC language, a language used by more programmers than any other language in the history of computing. Visual Basic has evolved from the original BASIC language and now certain several hundred statements, functions and keywords many of which relate directly to the window GUI has been added. Visual Basic allows professionals to accomplish anything that can be accomplished using any other windows programming language. Visual Basic is a Window programming language that has been developed at Microsoft Corporation. Visual Basic is a powerful programming language to develop sophisticated windows programs very quickly. Visual Basic is one of the Rapid Application Development tools as it enables the programmer to develop application very easily and very quickly.

Mind Breakers

Page 8 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Versions of Visual Basic


The original Visual Basic for DOS and Visual Basic for Windows were introduced in 1991. Visual Basic 3.0 (a vast improvement over previous versions) was released in 1993. Visual Basic 4.0 released in late 1995 (added 32 bit application support). Visual Basic 5.0 released in late 1996. New environment, supported creation of ActiveX controls, deleted 16 bit application support. And, then Visual Basic 6.0 with lots of advance features.

Features of Visual Basic 6.0


Faster compiler The .exe file of Visual Basic 6.0 uses a run time Dynamic-Link Library that we can freely distribute New ActiveX data control object Allows database integration with wide variety of applications New data report designer New Package & Deployment Wizard Additional internet capabilities At present the VB.net has been recently introduced in the market. The Visual Basic 6.0 comes as a part of the software package Visual Studio from the pocket of Microsoft.

Mind Breakers

Page 9 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Visual Basic is available in three editions for a specific set of development requirements.

1.

Learning Edition:

This edition of Visual Basic allows the programmers to easily create powerful applications for Microsoft Windows 95 and Windows NT. It includes all controls, grid, tab and data bound controls. Documentation provided with this edition includes learn Visual Basic now a printed programmers guide, online help, plus Visual Basic books online.
2.

Professional Edition:

This provides computer professionals with a full-featured set of tools for developing solution for others. It includes all features of the learning edition plus additional Active X controls, including Internet controls and the crystal report writer. Documentation provided with this includes the programmers guide, online
3.

Enterprise Edition:

This edition allows the professionals to create robust distributed applications in a team setting it includes all features of the Professional Edition plus a) The Automation Manager b) Component Manager c) Database Manager Tools d) The Microsoft Visual Safe Source Project oriented version control system.

Mind Breakers

Page 10 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Visual Basic is an event driven programming. Now let us have a look at its main points:

1. The Controls:
A Critical look at any application will tell you that it consists of a number of programs or procedures that perform various activities. For example there is one program that accepts text data from the user. There is another program that verifies numeric data accept text data from the user. There is another program that verifies numeric data entered by the user. There is another piece of code that picks up data from database. There is another program that locates a picture and places it on the screen the there is a routine also. Words like routines, procedures programs were discarded and the decided to call these as controls. So you have control that accepts data you have another control that pictures and another that helps you draw lines.

2. The Properties:
These controls are given certain attributes that are clearly defined. A control is supposed to do only such activity. For example control. Like Label should not allow its user to edit its contents, all such attributes are called as properties. So you have controls that certain activities and each control have certain properties.

3. Events:
Now there are a number of things that can happen to a control for example Command Button can be Clicked, as you can click the Start Button. In window text box can be populated or user may place a mouse pointer on the picture box.
Mind Breakers Page 11 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

These are all some of that can take place on an application. Visual Basic allows you to write code fro such activities the wonderful thing is that you have to write code only for those events that you are inserted in.

4. Methods:
The action taken when the event occurs is the method. You may want to exit the program when you press the command button or you may want to show a new picture when you click on a text box. Control in visual have many inbuilt methods.

Mind Breakers

Page 12 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Ms-Access is a RDBMS (Relational Database Management System) under Windows. It is used to store and manipulate large amount of data. The data is stored in multiple tables and Access allows us relationships between the tables to facilitate data retrieval. Ms-Access is an Object Oriented Program i.e. everything in MsAccess is an object. Each object has properties that define how it appears and what work it performs. Ms-Access has a number of components out of which the most important component is the Table object. Tables are objects that hold the data and all related objects such as Queries, Forms and Reports that are used to manage this data in tables. With the help of Access we can very easily find data and sort it. The package is very lightweight, easy to learn even for a novice user. It could be easily called in other languages like Java, Visual Basic, Visual FoxPro, C# etc. Its features make it quite a good package for data handling and many big companies uses it as a prime database. It also provides us security options to unable unacknowledged users to use database. Microsofts Access comes under the software package Microsofts Office. It was first introduced as a part of Office95, then Office97, Office2000 and now as a part of Office XP. In the project I have used MS Access from Office Xp. The main purpose of the package is to handle the database for insertion, deletion, updating and storage.

Mind Breakers

Page 13 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Mind Breakers

Page 14 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Telephone Dairy is designed for maintaining the telephone numbers and other details of persons. It can maintain complete detail like Name, Address, City, State, Up to Three Phone Numbers, FAX, Mobile No. and e-mail ID in a single record. This product also includes more than 165 ISD codes of all the major countries in this world and more than 750 STD codes of all the Indian major cities. In this product you can print the output using the Data Report option. The Back color and Fore Color of the windows can be changed.

Mind Breakers

Page 15 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

1.

Search Options:

In Telephone Diary we have two types of searches one is Simple Search and another is Advance Search. The Simple Search window automatically appears when we start the program (if window doesnt appear then we can open it form the Menu bar under View > Simple Search or by clicking on Simple Search option in the Toolbar). In this window we can search the database by giving First Name, Last Name or both. After inserting the name when we click on Search button the result will be displayed at the box given below. Right side of this window contains 26 buttons which has alphabets on it. As we move our mouse on these buttons they will increase in size, on clicking these buttons we can see the record starting with that particular alphabet. The second type of search is Advance Search. In this search we can find out the complete detail by inserting any information like First Name, Last Name, City, State, Any Phone Number, FAX or Mobile Number. This window can be open from the View Menu or Toolbar. For using Advance Search first of all select the Radio Button, for that field which you have like First Name, Phone (Shop) etc. then put the corresponding value in the text box given below and then click on Click Here For Search button. The result of your search will be automatically displays in a new window.
2.

ISD & STD Codes:

Telephone Diary includes the International Subscriber Dialing (ISD) codes of all the main countries of this world. In the ISD Codes window we can search the code of any country by scrolling down the scroll bar of Grid box or by inserting the name of the country in the text box and then by clicking the Search button. Similarly we can search the name of the country by inserting the code of the country in the text box. If any code
Mind Breakers Page 16 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

matches with more than one country then the result i.e. names of countries will be displayed by the Telephone Diary one by one. Telephone diary includes the STD codes of all the major cities of India. Similarly like ISD Codes in the STD Codes window we can search the code of any city by scrolling down the scroll bar of grid box or by inserting the name of the city in the text box and then by clicking the Search button. Similarly we can search the name of the city by inserting the code of the country in the text box. These windows can be open from the View Menu or Toolbar. Telephone Diary includes more than 165 ISD codes & 750 STD codes. If you want to add new STD or ISD code then this can be done by using the Add New button. This option is password protected. System will demand the Password only once when you use this option first time in new run.

3. Auto Add Feature:


This feature has two parts. Firstly while adding the new record in the database from the Database Window as you insert the name of the City in the City Textbox the STD code of that city will be automatically display in the STD Code Textbox i.e. you neednt have to enter the STD code. Secondly if you enter the name of the City in the City Textbox and the corresponding STD Code of that city doesnt appear in the STD Code Textbox then it means the name of the city you entered is not present in the database. In this case Telephone Diary will automatically enter the new City and STD code enter by you in the database. With this when next time you enter the name of same city then this time Telephone Diary will be automatically show the STD Code.
4.

Security:

Security is very serious matter in database maintaining. Anyone can change the records and cause great loss to us. In Telephone Diary the database is completely password protected. This product require two password one for open and another for changing the records. A person
Mind Breakers Page 17 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

who has the password to open can open the application. He can open all the windows and can navigate between the records. But nobody can Add, Delete, Update or Change the records without proper authority. Because these options are password protected. When anyone clicks on these buttons system will ask password. If correct password is not inserted then database will not change. But for better and fast working system will not ask from you password always when you use Add, Delete, Update or Change buttons. Once password is entered using any of these buttons then system will not ask for password till you close the program.
5.

Data Repots:

For printing the records this project include three types of Data Reports. In the first type of Data Report the complete record i.e. Name, Address, STD code, City, State, Phone Numbers etc can be printed. In the second type the report will display only address i.e. Name, Address, City & State. In the third type of report the name and the phone numbers can be printed.

Mind Breakers

Page 18 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Maintaining Telephone Numbers Easily Reduce Time Consumption Reduce Error Scopes Fast Search Maintaining Complete Information In Single Record Centralized Data Storages Availability & Easy Search of STD & ISD Codes

Mind Breakers

Page 19 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

PROCCESOR (Speed) RAM O/S SOFTWARE

At least 100 MHz OR HIGHER. 32.0 MB ATLEAST , 64 MB RECOMMENDED Win 9x, Windows Me, Windows XP, Windows Nt. VISUAL STUDIO 6.0 , OFFICE 2000 OR HIGHER VERSION MEDIA ATLEAST 1GB HARDDISK WITH

(if Visual Basic Installed) (if Visual Basic not Installed)

5 MB FREE SPACE 35 MB FREE SPACE (For .OCX Files)

These are the minimum hardware and software requirements needed to run the project.

Mind Breakers

Page 20 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Mind Breakers

Page 21 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

The Login Window


frmpassword:- As we start the .exe file a little window opens in the
center prompting to enter the username & password. If the password is incorrect after a warning message the user is again focused to enter the password. This will repeat three times and if correct password doesnt enter then this window will be closed automatically. If the password is correct then the main window is opened. The frmpassword layout is shown as following:

Coding:
Dim cntpass As Integer Private Sub cmdexit_Click() End End Sub Private Sub cmdOK_Click() Dim check As Integer '******************************************** ' Loading of Password from Database Load frmchangepass frmchangepass.ADODCPASS.Recordset.MoveFirst load_pass = frmchangepass.ADODCPASS.Recordset![opentd] PASSNAME = UCase(txtpassword) Unload frmchangepass Mind Breakers Page 22 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic '******************************************** If Trim(txtusername.Text) = "" Or Trim(txtusername.Text) = "Enter Your Name" Then msg = MsgBox("Please Enter Your Name", vbCritical, "Telephone Diary") txtusername.SetFocus txtusername.SelLength = Len(txtusername.Text) ElseIf Trim(txtusername.Text) <> "" Then If PASSNAME = load_pass Then frmSplash.Label1.Caption = "Hello '" & Trim(frmpassword.txtusername.Text) & "' Welcome To Sandeep's:" Unload frmpassword Load frmSplash frmSplash.Show ElseIf PASSNAME = "" Then msg2 = MsgBox("Please Enter Password", vbCritical, "No Password") txtpassword.SetFocus ElseIf PASSNAME <> load_pass Then cntpass = cntpass + 1 If cntpass <= 2 Then check = MsgBox("The Password Is Invalid", vbOKOnly + vbExclamation, "Invalid Password Error") txtpassword.Text = "" txtpassword.SetFocus ElseIf cntpass >= 3 Then check1 = MsgBox("Sorry, You Can't Login", vbOKOnly + vbExclamation, "Login Error") Unload Me End If End If End If End Sub Private Sub Form_GotFocus() txtusername.SetFocus End Sub Private Sub txtusername_GotFocus() txtusername.SelLength = Len(txtusername.Text) End Sub

Mind Breakers

Page 23 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

The Splash Screen


frmSplash
:- After the Login Window if correct password entered then a Splash Screen as shown under will be displayed. It remains for 5 seconds or until you click on it and then disappears automatically.

Coding:
Private Sub Frame1_Click() Load MDIForm1 MDIForm1.Show Unload Me End Sub Private Sub Timer1_Timer() Load MDIForm1 MDIForm1.Show Unload Me End Sub Mind Breakers Page 24 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

MDI Window
MDIForm1
:- After the Splash Screen when the project start then this window will be load. This window includes Menu bar, Toolbar & Status bar.

Coding:
Public passval As Integer Dim flag_frmmain As Integer Public change_command_color Private Sub MDIForm_Load() flag_frmmain = 0 Load frmformat frmformat.Hide Load mainsrh mainsrh.Show mainsrh.txtfname.SetFocus Mind Breakers Page 25 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic End Sub Private Sub MDIForm_Unload(Cancel As Integer) Unload frmformat End Sub Private Sub mnuaboutme_Click() Load frmaboutme frmaboutme.Show End Sub Private Sub mnuabouttd_Click() Load frmabouttd frmabouttd.Show End Sub Private Sub mnuadd_Click() DataReport2.Show End Sub Private Sub mnuadvancesearch1_Click() If mnusearchwin.Checked = True Then frminput.WindowState = 2 End If End Sub Private Sub mnuallrecord_Click() If mnushowall.Checked = True Then frmshowall.WindowState = 2 End If End Sub Private Sub mnuallrecords_Click() DataReport1.Show End Sub Private Sub mnubackcolor_Click() change_command_color = 0 CommonDialog1.ShowColor msgcom = MsgBox("Apply To Buttons Also(But You Can't Change Button's ForeColor)", vbYesNo, "Telephone Diary Format Message") If msgcom = vbYes Then change_command_color = 1 ElseIf msgcom = vbNo Then change_command_color = 0 End If frmformat.BackColor = CommonDialog1.Color Mind Breakers Page 26 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic If mnusimplesearch.Checked = True Or mnusearchwin.Checked = True Or _ mnustdcodes.Checked = True Or mnuisdcodes.Checked = True Or mnushowall.Checked = True _ Or mnudatabase.Checked = True Then MDIForm1.ActiveForm.BackColor = CommonDialog1.Color End If Call format_back_color End Sub Private Sub mnucascade_Click() MDIForm1.Arrange vbCascade End Sub Private Sub mnucloseall_Click() Unload frminput Unload frmisd Unload frmshowall Unload frmstd Unload mainsrh Unload frmmain End Sub Private Sub mnudatabase_Click() If mnudatabase.Checked = False Then frmmain.Show mnudatabase.Checked = True 'Load frmmain ElseIf mnudatabase.Checked = True Then frmmain.Hide mnudatabase.Checked = False 'Unload frmmain End If End Sub Private Sub mnudatabasepass_Click() Load frmchangepass frmchangepass.Show frmchangepass.changelbl.Caption = "Change Database Password" End Sub Private Sub mnudatabasewindow_Click() If mnudatabase.Checked = True Then frmmain.WindowState = 2 End If End Sub Private Sub mnudefault_Click() MDIForm1.ActiveForm.BackColor = mainsrh.color_at_startup frmformat.BackColor = mainsrh.color_at_startup Mind Breakers Page 27 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic Call format_back_color MDIForm1.ActiveForm.ForeColor = mainsrh.fore_color_at_startup frmformat.ForeColor = mainsrh.fore_color_at_startup Call format_fore_color End Sub Private Sub mnuexit_Click() msg = MsgBox("Are You Realy Want To Quit", vbYesNo, "Telephone Diary Exit Message") If msg = vbYes Then End ElseIf msg = vbNo Then Load MDIForm1 MDIForm1.Show End If End Sub Private Sub mnuforecolor_Click() CommonDialog1.ShowColor frmformat.ForeColor = CommonDialog1.Color If mnusimplesearch.Checked = True Or mnusearchwin.Checked = True Or _ mnustdcodes.Checked = True Or mnuisdcodes.Checked = True Or mnushowall.Checked = True _ Or mnudatabase.Checked = True Then MDIForm1.ActiveForm.ForeColor = CommonDialog1.Color Call format_fore_color End If End Sub Private Sub mnuhorizontally_Click() MDIForm1.Arrange vbTileHorizontal End Sub Private Sub mnuisdcodes_Click() If mnuisdcodes.Checked = False Then Load frmisd ElseIf mnuisdcodes.Checked = True Then Unload frmisd End If End Sub Private Sub mnuisdcodes1_Click() If mnuisdcodes.Checked = True Then frmisd.WindowState = 2 End If End Sub Private Sub mnumaxall_Click() If mnusearchwin.Checked = True Then Mind Breakers Page 28 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic frminput.WindowState = 2 End If If mnuisdcodes.Checked = True Then frmisd.WindowState = 2 End If If mnudatabase.Checked = True Then frmmain.WindowState = 2 End If If mnushowall.Checked = True Then frmshowall.WindowState = 2 End If If mnustdcodes.Checked = True Then frmstd.WindowState = 2 End If If mnusimplesearch.Checked = True Then mainsrh.WindowState = 2 End If End Sub Private Sub mnuminall_Click() If mnusearchwin.Checked = True Then frminput.WindowState = 1 End If If mnuisdcodes.Checked = True Then frmisd.WindowState = 1 End If If mnudatabase.Checked = True Then frmmain.WindowState = 1 End If If mnushowall.Checked = True Then frmshowall.WindowState = 1 End If If mnustdcodes.Checked = True Then frmstd.WindowState = 1 End If If mnusimplesearch.Checked = True Then mainsrh.WindowState = 1 End If End Sub Private Sub mnuopenall_Click() Load frminput Load frmisd Load frmstd Load frmmain Load frmshowall Load mainsrh Mind Breakers Page 29 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic End Sub Private Sub mnuphonenumbers_Click() DataReport3.Show End Sub Private Sub mnusearchwin_Click() If mnusearchwin.Checked = True Then Unload frminput ElseIf mnusearchwin.Checked = False Then Load frminput End If End Sub Private Sub mnushowwindow_Click() If mnushowwindow.Checked = True Then Unload frmshow ElseIf mnushowwindow.Checked = False Then Load frmshow End If End Sub Private Sub mnushowall_Click() If mnushowall.Checked = True Then Unload frmshowall ElseIf mnushowall.Checked = False Then If mnudatabase.Checked = True Then frmshowall.check_frmmain = 1 ElseIf mnudatabase.Checked = False Then frmshowall.check_frmmain = 0 End If Load frmmain Load frmshowall End If End Sub Private Sub mnusimplesearch_Click() If mnusimplesearch.Checked = True Then Unload mainsrh ElseIf mnusimplesearch.Checked = False Then Load mainsrh End If End Sub Private Sub mnusimplesearch1_Click() If mnusimplesearch.Checked = True Then mainsrh.WindowState = 2 Mind Breakers Page 30 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic End If End Sub Private Sub mnustartup_Click() Load frmchangepass frmchangepass.Show frmchangepass.changelbl.Caption = "Change StartUp Password" End Sub Private Sub mnustdcodes_Click() If mnustdcodes.Checked = True Then Unload frmstd ElseIf mnustdcodes.Checked = False Then Load frmstd End If End Sub Private Sub mnustdcodes1_Click() If mnustdcodes.Checked = True Then frmstd.WindowState = 2 End If End Sub Private Sub mnutoolbar_Click() If mnutoolbar.Checked = True Then Toolbar1.Visible = False mnutoolbar.Checked = False ElseIf mnutoolbar.Checked = False Then Toolbar1.Visible = True mnutoolbar.Checked = True End If End Sub Private Sub mnuvertically_Click() MDIForm1.Arrange vbTileVertical End Sub Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) Select Case Button.Caption Case Is = "Advance Search" Load frminput frminput.WindowState = 2 Case Is = "STD Codes" Load frmstd frmstd.WindowState = 2 Case Is = "ISD Codes" Load frmisd Mind Breakers Page 31 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic frmisd.WindowState = 2 Case Is = "Go To Database" 'Unload frmmain mnudatabase.Checked = True frmmain.Show '/Load frmmain frmmain.WindowState = 2 frmmain.Adodc.Refresh Case Is = "Show All Records" If mnudatabase.Checked = True Then frmshowall.check_frmmain = 1 ElseIf mnudatabase.Checked = False Then frmshowall.check_frmmain = 0 End If Load frmmain Load frmshowall frmshowall.WindowState = 2 Case Is = "Simple Search" Load mainsrh mainsrh.WindowState = 2 Case Is = "Exit" msg = MsgBox("Do You Realy Want To Quit", vbYesNo, "Telephone Diary Exit Message") If msg = vbYes Then End ElseIf msg = vbNo Then Load MDIForm1 MDIForm1.Show End If End Select End Sub Public Sub format_back_color() MDIForm1.ActiveForm.BackColor = frmformat.BackColor For Each Control In MDIForm1.ActiveForm If TypeOf Control Is Frame Then Control.BackColor = frmformat.BackColor End If If change_command_color = 1 Then If TypeOf Control Is CommandButton Then Control.BackColor = frmformat.BackColor End If ElseIf change_command_color = 0 Then If TypeOf Control Is CommandButton Then Control.BackColor = mainsrh.command_color_at_startup End If End If If TypeOf Control Is OptionButton Then Control.BackColor = frmformat.BackColor Mind Breakers Page 32 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic End If Next Control End Sub Public Sub format_fore_color() For Each Control In MDIForm1.ActiveForm If TypeOf Control Is Frame Then Control.ForeColor = frmformat.ForeColor End If If TypeOf Control Is Label Then Control.ForeColor = frmformat.ForeColor End If If TypeOf Control Is OptionButton Then Control.ForeColor = frmformat.ForeColor End If Next Control End Sub Public Sub chkdatapassword() '******************************************** ' Loading of Password from Database Load frmchangepass frmchangepass.ADODCPASS.Recordset.MoveFirst load_pass = frmchangepass.ADODCPASS.Recordset![Database] 'PASSNAME = UCase(txtpassword) Unload frmchangepass '******************************************** If passval = 0 Then chk = InputBox("Enter The Password To Make Changes In Database", "Telephone Diary 'Database Password' Entry Box") chk = UCase(chk) If chk = load_pass Then passval = 1 ElseIf chk <> load_pass Then out = MsgBox("Sorry You Can't Make Changes In The Database", vbOKOnly, "Telephone Diary") End If End If End Sub

Simple Search Window


mainsrh
Mind Breakers

:- When MDIForm1 load this window will automatically loads. This window is for search database from the First Name, Last Name or both. The Result of this search wills also displayed in the same window.
Page 33 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Coding:
'Main Form Which Load Automatically When MDIForm1 Load Dim tval, tval1 Public color_at_startup Public fore_color_at_startup Public command_color_at_startup Dim rcdcount Dim tmp_atoz Dim count_atoz Private Sub alpha_Click(Index As Integer) Frame1(1).Caption = "Search Result" Call alpha_search(alpha(Index).Caption) End Sub Private Sub alpha_LostFocus(Index As Integer) alpha(Index).Width = 480 Mind Breakers Page 34 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic alpha(Index).Height = 375 alpha(Index).FontSize = 10 alpha(Index).FontItalic = False End Sub Private Sub alpha_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) alpha(Index).SetFocus alpha(Index).Width = 600 alpha(Index).Height = 600 alpha(Index).FontSize = 14 alpha(Index).FontItalic = True End Sub Private Sub cmdclear_Click() txtfname.Text = "" txtlname.Text = "" lst.Clear Frame1(1).Caption = "Search Result" txtfname.SetFocus End Sub 'Same As Search In frmmain And Other Forms Private Sub Command1_Click() rcdcount = 0 lst.Clear tval = Trim(UCase(txtfname.Text)) tval1 = Trim(UCase(txtlname.Text)) If txtfname.Text <> "" And txtlname.Text <> "" Then temp = 0 frmmain.Adodc.Recordset.MoveFirst Do Until frmmain.Adodc.Recordset.EOF If (frmmain.Adodc.Recordset![st_fname] = tval) And (frmmain.Adodc.Recordset![st_Lname] = tval1) Then display_data Else temp = temp + 1 End If frmmain.Adodc.Recordset.MoveNext Loop If temp = frmmain.Adodc.Recordset.RecordCount Then Call record_not_found End If ElseIf txtfname.Text <> "" And txtlname.Text = "" Then temp = 0 frmmain.Adodc.Recordset.MoveFirst Do Until frmmain.Adodc.Recordset.EOF Mind Breakers Page 35 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic If (frmmain.Adodc.Recordset![st_fname] = tval) Then display_data Else temp = temp + 1 End If frmmain.Adodc.Recordset.MoveNext Loop If temp = frmmain.Adodc.Recordset.RecordCount Then Call record_not_found End If ElseIf txtfname.Text = "" And txtlname.Text <> "" Then temp = 0 frmmain.Adodc.Recordset.MoveFirst Do Until frmmain.Adodc.Recordset.EOF If (frmmain.Adodc.Recordset![st_Lname] = tval1) Then display_data Else temp = temp + 1 End If frmmain.Adodc.Recordset.MoveNext Loop If temp = frmmain.Adodc.Recordset.RecordCount Then Call record_not_found End If ElseIf txtfname.Text = "" And txtlname.Text = "" Then msg1 = MsgBox("Please Enter First Name\Last Name Or Both", vbCritical, "Telephone Diary Error") End If If rcdcount = 1 Then Frame1(1).Caption = "Search Result: " & rcdcount & " Record Matched" ElseIf rcdcount >= 2 Then Frame1(1).Caption = "Search Result: " & rcdcount & " Records Matched" End If End Sub Public Sub display_data() rcdcount = rcdcount + 1 vst_fname = frmmain.Adodc.Recordset![st_fname] vst_lname = frmmain.Adodc.Recordset![st_Lname] lst.AddItem "NAME:" & Space(14) & vst_fname & " " & vst_lname If show_what(0).Value = 1 Then Call show_address End If If show_what(1).Value = 1 Then Call show_phone End If If show_what(2).Value = 1 Then Mind Breakers Page 36 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic Call show_others End If frmmain.Hide lst.AddItem "======================================================================= ======================================" End Sub Public Sub record_not_found() frmmain.Hide inkey1 = MsgBox("The Record Name:" & tval & " " & tval1 & " Is Not Found In The Database. ", vbOKOnly, "Telephone Diary Information") txtfname.Text = "" txtlname.Text = "" txtfname.SetFocus End Sub Private Sub Form_Activate() Call MDIForm1.format_back_color Call MDIForm1.format_fore_color End Sub Private Sub Form_Load() MDIForm1.mnusimplesearch.Checked = True color_at_startup = mainsrh.BackColor fore_color_at_startup = mainsrh.ForeColor command_color_at_startup = mainsrh.cmdclear.BackColor End Sub Private Sub Form_Unload(Cancel As Integer) MDIForm1.mnusimplesearch.Checked = False End Sub Private Sub OK_Click() Unload Me Load mainsrh End Sub Private Sub txtlname_LostFocus() Command1.SetFocus End Sub Public Function alpha_search(alpha_to_found As String) rcdcount = 0 lst.Clear temp = 0 frmmain.Adodc.Recordset.MoveFirst Mind Breakers Page 37 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic Do Until frmmain.Adodc.Recordset.EOF temp_record_store = frmmain.Adodc.Recordset![st_fname] temp_record_store_leftchar = Left(temp_record_store, 1) If temp_record_store_leftchar = alpha_to_found Then display_data Else temp = temp + 1 End If frmmain.Adodc.Recordset.MoveNext Loop If temp = frmmain.Adodc.Recordset.RecordCount Then frmmain.Hide inkey1 = MsgBox("The Record Starting From '" & alpha_to_found & "' Is Not Found In The Database. ", vbOKOnly, "Telephone Diary Information") End If If rcdcount = 1 Then Frame1(1).Caption = "Search Result: " & rcdcount & " Record Matched" ElseIf rcdcount >= 2 Then Frame1(1).Caption = "Search Result: " & rcdcount & " Records Matched" End If End Function Public Function show_others() vst_email = frmmain.Adodc.Recordset![st_email] lst.AddItem "E-MAIL ID: " & Space(6) & vst_email End Function Public Function show_phone() vst_fax = frmmain.Adodc.Recordset![st_fax] vst_mobile = frmmain.Adodc.Recordset![st_mobile] vst_std = frmmain.Adodc.Recordset![st_std] vst_ph1 = frmmain.Adodc.Recordset![st_ph1] vst_ph2 = frmmain.Adodc.Recordset![st_ph2] vst_ph3 = frmmain.Adodc.Recordset![st_ph3] lst.AddItem "STD CODE:" & Space(7) & vst_std lst.AddItem "PHONE NO:" & Space(6) & vst_ph1 & "(Shop)" & Space(10) & vst_ph2 & "(Resi)" & Space(10) & vst_ph3 & "(Other)" lst.AddItem "FAX:" & Space(17) & vst_fax & Space(10) & "Mobile No.: " & vst_mobile End Function Public Function show_address() vst_add1 = frmmain.Adodc.Recordset![st_add1] vst_add2 = frmmain.Adodc.Recordset![st_add2] vst_city = frmmain.Adodc.Recordset![st_city] vst_state = frmmain.Adodc.Recordset![st_state] If Len(Trim(vst_add2)) >= 1 Then lst.AddItem "ADDRESS: " & Space(7) & vst_add1 Mind Breakers Page 38 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic lst.AddItem Space(26) & vst_add2 Else lst.AddItem "ADDRESS: " & Space(7) & vst_add1 End If lst.AddItem "CITY(STATE):" & Space(2) & vst_city & "(" & vst_state & ")" End Function

Advance Search Window


frminput
:- This window is designed for search database by inserting any option like name, city, phone no etc. The Result of this search will be displayed in the new window.

Mind Breakers

Page 39 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Coding:
Dim tval As String 'variable used for storing input value Dim rcdcount As Integer 'count no of records match with input made 'Coding For Search Private Sub cmdOK_Click() If txtinput.Text = "" Then 'If No Input Is Made msg = MsgBox("Please Enter The Name\Number For Search", vbCritical, "Telephone Diary Error Message") Else 'if input is made tval = Trim(UCase(frminput.txtinput.Text)) 'remove blank spaces and convert input into upper case 'optfn,optln etc. are the names of option buttons 'frmmain is the name of database window If optfn.Value = True Then temp = 0 'simply variable used as counter frmmain.Adodc.Recordset.MoveFirst 'moves database to first record rcdcount = 1 Mind Breakers Page 40 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic 'Assign Intial Value Do Until frmmain.Adodc.Recordset.EOF 'i.e. Move Untill Last Record If (frmmain.Adodc.Recordset![st_fname] = tval) Then 'st_fname Is The Field Name Of First Name In Database 'If Input Match With Record In The Database display_data 'Go To display_data procedure rcdcount = rcdcount + 1 'Counter Adding Value Else 'If Input Doesn't Match With Record In The Database temp = temp + 1 'Adding Value To Temp End If frmmain.Adodc.Recordset.MoveNext 'Move To Next Record Loop 'Return To Do Untill If temp = frmmain.Adodc.Recordset.RecordCount Then 'if temp=Total No.s Of Record Call record_not_found 'Go To record_not_found procedure End If '****************************************************** 'Same As Above ElseIf optln.Value = True Then temp = 0 frmmain.Adodc.Recordset.MoveFirst rcdcount = 1 Do Until frmmain.Adodc.Recordset.EOF If (frmmain.Adodc.Recordset![st_Lname] = tval) Then display_data rcdcount = rcdcount + 1 Else temp = temp + 1 End If frmmain.Adodc.Recordset.MoveNext Loop If temp = frmmain.Adodc.Recordset.RecordCount Then Call record_not_found End If '****************************************************** ElseIf optc.Value = True Then temp = 0 frmmain.Adodc.Recordset.MoveFirst rcdcount = 1 Do Until frmmain.Adodc.Recordset.EOF Mind Breakers Page 41 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic If (frmmain.Adodc.Recordset![st_city] = tval) Then display_data rcdcount = rcdcount + 1 Else temp = temp + 1 End If frmmain.Adodc.Recordset.MoveNext Loop If temp = frmmain.Adodc.Recordset.RecordCount Then Call record_not_found End If '****************************************************** ElseIf opts.Value = True Then temp = 0 frmmain.Adodc.Recordset.MoveFirst rcdcount = 1 Do Until frmmain.Adodc.Recordset.EOF If (frmmain.Adodc.Recordset![st_state] = tval) Then display_data rcdcount = rcdcount + 1 Else temp = temp + 1 End If frmmain.Adodc.Recordset.MoveNext Loop If temp = frmmain.Adodc.Recordset.RecordCount Then Call record_not_found End If '****************************************************** ElseIf optps.Value = True Then temp = 0 frmmain.Adodc.Recordset.MoveFirst rcdcount = 1 Do Until frmmain.Adodc.Recordset.EOF If (frmmain.Adodc.Recordset![st_ph1] = tval) Then display_data rcdcount = rcdcount + 1 Else temp = temp + 1 End If frmmain.Adodc.Recordset.MoveNext Loop If temp = frmmain.Adodc.Recordset.RecordCount Then Call record_not_found End If '****************************************************** ElseIf optpr.Value = True Then Mind Breakers Page 42 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic temp = 0 frmmain.Adodc.Recordset.MoveFirst rcdcount = 1 Do Until frmmain.Adodc.Recordset.EOF If (frmmain.Adodc.Recordset![st_ph2] = tval) Then display_data rcdcount = rcdcount + 1 Else temp = temp + 1 End If frmmain.Adodc.Recordset.MoveNext Loop If temp = frmmain.Adodc.Recordset.RecordCount Then Call record_not_found End If '****************************************************** ElseIf optpo.Value = True Then temp = 0 frmmain.Adodc.Recordset.MoveFirst rcdcount = 1 Do Until frmmain.Adodc.Recordset.EOF If (frmmain.Adodc.Recordset![st_ph3] = tval) Then display_data rcdcount = rcdcount + 1 Else temp = temp + 1 End If frmmain.Adodc.Recordset.MoveNext Loop If temp = frmmain.Adodc.Recordset.RecordCount Then Call record_not_found End If '****************************************************** ElseIf optf.Value = True Then temp = 0 frmmain.Adodc.Recordset.MoveFirst rcdcount = 1 Do Until frmmain.Adodc.Recordset.EOF If (frmmain.Adodc.Recordset![st_fax] = tval) Then display_data rcdcount = rcdcount + 1 Else temp = temp + 1 End If frmmain.Adodc.Recordset.MoveNext Loop If temp = frmmain.Adodc.Recordset.RecordCount Then Mind Breakers Page 43 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic Call record_not_found End If '****************************************************** ElseIf optmn.Value = True Then temp = 0 frmmain.Adodc.Recordset.MoveFirst rcdcount = 1 Do Until frmmain.Adodc.Recordset.EOF If (frmmain.Adodc.Recordset![st_mobile] = tval) Then display_data rcdcount = rcdcount + 1 Else temp = temp + 1 End If frmmain.Adodc.Recordset.MoveNext Loop If temp = frmmain.Adodc.Recordset.RecordCount Then Call record_not_found End If End If End If End Sub 'Procedure For Store Search Result And Display Public Sub display_data() frminput.Hide frmoutput.Show '-----------------------------------------------------'Store Result Of Different Fields In Different variables vst_fname = frmmain.Adodc.Recordset![st_fname] vst_lname = frmmain.Adodc.Recordset![st_Lname] vst_city = frmmain.Adodc.Recordset![st_city] vst_state = frmmain.Adodc.Recordset![st_state] vst_ph1 = frmmain.Adodc.Recordset![st_ph1] vst_ph2 = frmmain.Adodc.Recordset![st_ph2] vst_ph3 = frmmain.Adodc.Recordset![st_ph3] vst_fax = frmmain.Adodc.Recordset![st_fax] vst_mobile = frmmain.Adodc.Recordset![st_mobile] vst_add1 = frmmain.Adodc.Recordset![st_add1] vst_add2 = frmmain.Adodc.Recordset![st_add2] vst_std = frmmain.Adodc.Recordset![st_std] vst_email = frmmain.Adodc.Recordset![st_email] '-----------------------------------------------------frmmain.Hide ' Just Used To Display The No Of Records Match In The Output Window If rcdcount = 1 Then frmoutput.Label1.Caption = "Only One Record Match" Mind Breakers Page 44 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic ElseIf rcdcount > 1 Then frmoutput.Label1.Caption = "Total Numbers Of Records Match Are " & rcdcount End If 'Adding The Values Of Result In The Output Window List Box 'lstresult is the name of list box used in output window frmoutput.lstresult.AddItem "(" & rcdcount & ") " & "Name: " & vst_fname & " " & vst_lname frmoutput.lstresult.AddItem " Address: " & vst_add1 & ", " & vst_add2 frmoutput.lstresult.AddItem " City: " & vst_city & ", State:" & vst_state & ", STD Code: " & vst_std frmoutput.lstresult.AddItem " Phone No:- Shop: " & vst_ph1 & " Resi: " & vst_ph2 + " Other: " + vst_ph3 frmoutput.lstresult.AddItem " Fax: " & vst_fax & " Mobile No.: " & vst_mobile frmoutput.lstresult.AddItem " Email: " & vst_email frmoutput.lstresult.AddItem "------------------------------------------------------------------------------------------------------" End Sub Private Sub Form_Activate() Call MDIForm1.format_back_color Call MDIForm1.format_fore_color End Sub 'Form For Searching Database With Advance Options '------------------------------------------------Private Sub Form_Load() MDIForm1.mnusearchwin.Checked = True 'Displays Sign Of Check In The MDIForm View Menu Unload frmoutput 'Name Of Search Result Window frminput.Show optfn.SetFocus 'Set Focus To 'FirstName' Option Button End Sub 'Remove Sign Of Check From The MDIForm View Menu Private Sub Form_Unload(Cancel As Integer) MDIForm1.mnusearchwin.Checked = False End Sub 'Procedure Used If While Search Record Not Found Public Sub record_not_found() frmmain.Hide 'frmmain i.e. Database form,Hide Because Opens Automatically While Searching inkey = MsgBox("The Record Name/Number: " & tval & " Is Not Found In The Database. ", vbOKOnly, "Telephone Diary Information") Load frminput 'Name Of Advance Search Window frminput.Show frminput.WindowState = 2 frminput.txtinput.Text = "" Mind Breakers Page 45 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic frminput.txtinput.SetFocus End Sub Private Sub Frame3_DragDrop(Source As Control, X As Single, Y As Single) End Sub '------------------------------------------------------------------' Change Caption And Set Focus To Corresponding Text Box Private Sub optc_Click() Frame1(0).Caption = "Enter Name Of City Here:" txtinput.SetFocus End Sub Private Sub optf_Click() Frame1(0).Caption = "Enter Fax Number Here:" txtinput.SetFocus End Sub Private Sub optfn_Click() Frame1(0).Caption = "Enter First Name Here:" txtinput.SetFocus End Sub Private Sub optln_Click() Frame1(0).Caption = "Enter Last Name Here:" txtinput.SetFocus End Sub Private Sub optmn_Click() Frame1(0).Caption = "Enter Mobile Number Here:" txtinput.SetFocus End Sub Private Sub optpo_Click() Frame1(0).Caption = "Enter Other Phone Number Here:" txtinput.SetFocus End Sub Private Sub optpr_Click() Frame1(0).Caption = "Enter Residence Phone Number Here:" txtinput.SetFocus End Sub Private Sub optps_Click() Frame1(0).Caption = "Enter Shop Phone Number Here:" txtinput.SetFocus Mind Breakers Page 46 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic End Sub Private Sub opts_Click() Frame1(0).Caption = "Enter Name Of State Here:" txtinput.SetFocus End Sub '-------------------------------------------------------------------

ISD Codes
frmisd
:- This window is designed for search and adding ISD codes. In ISD Codes database more than 165 codes are already inserted.

Mind Breakers

Page 47 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Coding:
'Form For Searching ISD Codes And Adding More ISD Codes '-----------------------------------------------------Dim count_result As Integer 'variable used as counter for Matched Result Dim tval As String 'variable for storing input made by used 'For Adding New ISD Code Private Sub cmdadd_Click() Call MDIForm1.chkdatapassword If MDIForm1.passval = 1 Then Load frmaddnewisd frmaddnewisd.Show frmaddnewisd.Adodc1.Recordset.AddNew End If End Sub 'Clear All Text Boxes Private Sub cmdclear_Click() txtinput.Text = "" txtoutput.Text = "" Mind Breakers Page 48 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic txtinput.SetFocus End Sub 'Search The ISD Database Private Sub cmdsearch_Click() tval = Trim(UCase(txtinput.Text)) '----------------------------------------------------------------If opt1.Value = True Then 'If Search Made For ISD Code From Name of Country temp = 0 frmaddnewisd.Adodc1.Recordset.MoveFirst count_result = 0 Do Until frmaddnewisd.Adodc1.Recordset.EOF If (frmaddnewisd.Adodc1.Recordset![ST_NAME] = tval) Then count_result = count_result + 1 txtoutput.Text = frmaddnewisd.Adodc1.Recordset![ST_ISDCODES] If count_result >= 2 Then 'Count Whether One Record Present or More msg = MsgBox("More Than 1 Record Found,Click OK To See Next Results", vbOKOnly, "Telephone Diary Information") End If Else temp = temp + 1 End If frmaddnewisd.Adodc1.Recordset.MoveNext Loop If temp = frmaddnewisd.Adodc1.Recordset.RecordCount Then inkey = MsgBox("The Country With Name:" & tval & " Is Not Found In The Database. ", vbOKOnly, "Telephone Diary Information") frmisd.txtinput.Text = "" frmisd.txtinput.SetFocus End If ElseIf opt2.Value = True Then temp = 0 frmaddnewisd.Adodc1.Recordset.MoveFirst count_result = 0 Do Until frmaddnewisd.Adodc1.Recordset.EOF If (frmaddnewisd.Adodc1.Recordset![ST_ISDCODES] = tval) Then count_result = count_result + 1 txtoutput.Text = frmaddnewisd.Adodc1.Recordset![ST_NAME] If count_result >= 2 Then 'Count Whether One Record Present or More msg = MsgBox("More Than 1 Record Found,Click OK To See Next Results", vbOKOnly, "Telephone Diary Information") End If Else temp = temp + 1 End If frmaddnewisd.Adodc1.Recordset.MoveNext Mind Breakers Page 49 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic Loop If temp = frmaddnewisd.Adodc1.Recordset.RecordCount Then inkey = MsgBox("The Code With Number:" & tval & " Is Not Found In The Database. ", vbOKOnly, "Telephone Diary Information") frmisd.txtinput.Text = "" frmisd.txtinput.SetFocus End If End If End Sub Private Sub Form_Activate() Call MDIForm1.format_back_color Call MDIForm1.format_fore_color End Sub Private Sub Form_Load() MDIForm1.mnuisdcodes.Checked = True frmisd.opt1.Value = True End Sub Private Sub Form_Unload(Cancel As Integer) MDIForm1.mnuisdcodes.Checked = False End Sub Private Sub opt1_Click() Frame1(0).Caption = "Enter Country Name Here:" Frame1(2).Caption = "ISD Code Is:" txtinput.Text = "" txtoutput.Text = "" End Sub Private Sub opt2_Click() Frame1(0).Caption = "Enter Code Here:" Frame1(2).Caption = "Country Name Is:" txtinput.Text = "" txtoutput.Text = "" End Sub

STDCodes
frmstd
:- This window is designed for search and adding STD codes. In STD Codes database more than 750 codes have been inserted.

Mind Breakers

Page 50 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Coding:
'Form For Searching STD Codes And Adding More STD Codes '-----------------------------------------------------Dim count_result As Integer 'variable used as counter for Matched Result Dim tval As String 'variable for storing input made by used Dim temp As Integer 'variable used as counter for UnMatched Result 'For Adding New STD Code Private Sub cmdadd_Click() Call MDIForm1.chkdatapassword If MDIForm1.passval = 1 Then Load frmaddnewstd 'form for adding new STD Code frmaddnewstd.Show frmaddnewstd.Adodc1.Recordset.AddNew 'Control On form End If End Sub 'Clear All Text Boxes Private Sub cmdclear_Click() txtinput.Text = "" Mind Breakers Page 51 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic txtoutput.Text = "" txtinput.SetFocus End Sub 'Search The STD Database Private Sub cmdsearch_Click() tval = Trim(UCase(txtinput.Text)) '----------------------------------------------------------------If opt1.Value = True Then 'If Search Made For STD Code From Name of City temp = 0 frmaddnewstd.Adodc1.Recordset.MoveFirst count_result = 0 Do Until frmaddnewstd.Adodc1.Recordset.EOF If (frmaddnewstd.Adodc1.Recordset![ST_NAME] = tval) Then 'ST_NAME is the name of the field count_result = count_result + 1 If count_result = 1 Then 'Count Whether One Record Present or More 'Run Only If One Record Match txtoutput.Text = frmaddnewstd.Adodc1.Recordset![ST_STDCODES] 'ST_STDCODES is the name of the field 'diplays resulted STD code in result text box ElseIf count_result >= 2 Then 'Run Only If More Than One Record Match msg = MsgBox("More Than 1 Record Found,Click OK To See Next Results", vbOKOnly, "Telephone Diary Information") 'With Clicking Yes Next Record Will Be Displayed txtoutput.Text = frmaddnewstd.Adodc1.Recordset![ST_STDCODES] 'diplays resulted STD code in result text box One By One End If Else temp = temp + 1 'Run Only Record Doesn't Match End If frmaddnewstd.Adodc1.Recordset.MoveNext 'Move To Next record Loop If temp = frmaddnewstd.Adodc1.Recordset.RecordCount Then 'if No Record Match In Whole Database inkey = MsgBox("The City With Name:" & tval & " Is Not Found In The Database. ", vbOKOnly, "Telephone Diary Information") frmstd.txtinput.Text = "" frmstd.txtinput.SetFocus End If '----------------------------------------------------------------ElseIf opt2.Value = True Then Mind Breakers Page 52 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic 'If Search Made For Name of City From STD Code 'Same As Above temp = 0 frmaddnewstd.Adodc1.Recordset.MoveFirst count_result = 0 Do Until frmaddnewstd.Adodc1.Recordset.EOF If (frmaddnewstd.Adodc1.Recordset![ST_STDCODES] = tval) Then count_result = count_result + 1 If count_result = 1 Then txtoutput.Text = frmaddnewstd.Adodc1.Recordset![ST_NAME] ElseIf count_result >= 2 Then msg = MsgBox("More Than 1 Record Found,Click OK To See Next Results", vbOKOnly, "Telephone Diary Information") txtoutput.Text = frmaddnewstd.Adodc1.Recordset![ST_NAME] End If Else temp = temp + 1 End If frmaddnewstd.Adodc1.Recordset.MoveNext Loop If temp = frmaddnewstd.Adodc1.Recordset.RecordCount Then inkey = MsgBox("The Code With Number:" & tval & " Is Not Found In The Database. ", vbOKOnly, "Telephone Diary Information") frmstd.txtinput.Text = "" frmstd.txtinput.SetFocus End If End If End Sub Private Sub Form_Activate() Call MDIForm1.format_back_color Call MDIForm1.format_fore_color End Sub Private Sub Form_Load() MDIForm1.mnustdcodes.Checked = True 'Displays Sign Of Check In The MDIForm View Menu opt1.Value = True DataGrid1.Refresh End Sub Private Sub Form_Unload(Cancel As Integer) MDIForm1.mnustdcodes.Checked = False 'Remove Sign Of Check From The MDIForm View Menu End Sub 'Option For Search STD Mind Breakers Page 53 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic Private Sub opt1_Click() Frame1(0).Caption = "Enter Name Of City Here:" Frame1(2).Caption = "STD Code Is:" txtinput.Text = "" txtoutput.Text = "" End Sub 'Option For Search Name Of City Private Sub opt2_Click() Frame1(0).Caption = "Enter Code Of City Here:" Frame1(2).Caption = "Name Of City Is:" txtinput.Text = "" txtoutput.Text = "" End Sub

Database Window
frmmain
:- This is the most important window of this project. This window is used for navigating between the records. Only with the help of this window we can Add, Change, Delete or Update record. All these options are password protected i.e. you none can change the records until he knows the password.
Mind Breakers Page 54 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Coding:
'Form For Maintaing Database With Advance Options '------------------------------------------------Dim flag_count_move_first_click As Integer Dim flag_count_move_last_click As Integer Dim count_add_std As Integer Dim countemail As Integer 'Button For Changing Records Run Only If Database Password Is Entered Private Sub cmdchange_Click() 'On Error GoTo err_change Call MDIForm1.chkdatapassword If MDIForm1.passval = 1 Then input_name = InputBox("Enter First Name Of Person You Are Looking For", "Change Record") If input_name = "" Then Exit Sub End If tval = UCase(Trim(input_name)) Mind Breakers Page 55 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic temp = 0 'simply variable used as counter Adodc.Recordset.MoveFirst cnt = Adodc.Recordset.RecordCount Do Until move_record = cnt - 1 ' Adodc.Recordset.EOF If (Adodc.Recordset![st_fname] = tval) Then cc = MsgBox("Do you Want To Change This Record", vbYesNo, "Change Record") If cc = vbYes Then Call tassign_true txtfname.SetFocus Exit Sub End If Else temp = temp + 1 End If Adodc.Recordset.MoveNext move_record = move_record + 1 Loop 'Return To Do Untill temp = temp + 1 If temp = Adodc.Recordset.RecordCount Then Adodc.Recordset.MoveFirst dd1 = MsgBox("There Is No Record Of '" & tval & "' In This Database", vbOKOnly, "Change Record") ElseIf temp <> Adodc.Recordset.RecordCount Then Adodc.Recordset.MoveFirst dd = MsgBox("There Is No More Record Of '" & tval & "' In This Database", vbOKOnly, "Change Record") End If End If 'err_change: 'a = MsgBox("Error While Changing Record(Error No." & Err & "), " & Err.Description, vbCritical, "Telephone Diary Error Message") End Sub Private Sub cmdclose_Click() Unload Me End Sub 'Count Total No Of Records Private Sub cmdcount_Click() Dim total As Integer, im As Integer total = Adodc.Recordset.RecordCount im = MsgBox(" Total Number Records are " + Str(total), vbInformation, "Telephone Diary Information") End Sub 'Button For Delete Run Only If Database Password Is Entered Mind Breakers Page 56 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic Private Sub cmddelete_Click() Call MDIForm1.chkdatapassword If MDIForm1.passval = 1 Then fordelete 'Procedure designed for deleting records End If Exit Sub err_del: a = MsgBox("Error While Deleting Record(Error No." & Err & "), " & Err.Description, vbCritical, "Telephone Diary Error Message") End Sub 'Button For Moving To First Record Private Sub cmdfirst_Click() On Error GoTo err_fst Call count_position_first 'Procedure Designed For Moving To First Record Call tassign_false 'tassign_false:Disables All Text Boxes Adodc.Recordset.MoveFirst 'Display Message If Already At First Record 'Idea Behind It (When Record Moves To First It Store 1 To Counter_ '_While Moving From First Record Store 0 To Counter) If flag_count_move_first_click = 0 Then flag_count_move_first_click = 1 Else b = MsgBox("Already on the First Record...", vbInformation, "Telephone Diary Information") End If Exit Sub err_fst: a = MsgBox("Error While Moving First Record (Error No." & Err & "), " & Err.Description, vbCritical, "Telephone Diary Error Message") End Sub 'Button For Moving To Last Record Private Sub cmdlast_Click() On Error GoTo err_last Call count_position_last 'Procedure Designed For Moving To Last Record Call tassign_false 'tassign_false:Disables All Text Boxes Adodc.Recordset.MoveLast 'Display Message If Already At Last Record 'Same As In Case Of Move First Record Mind Breakers Page 57 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic If flag_count_move_last_click = 0 Then flag_count_move_last_click = 1 Else b = MsgBox("Already on the Last Record...", vbInformation, "Telephone Diary Information") End If Exit Sub err_last: a = MsgBox("Error While Moving Last Record (Error No." & Err & "), " & Err.Description, vbCritical, "Telephone Diary Error Message") End Sub 'Button For Adding New Record Run Only If Database Password Is Entered Private Sub cmdnew_Click() On Error GoTo err_add 'Same As In Case Of Change Button Call MDIForm1.chkdatapassword If MDIForm1.passval = 1 Then Call fornew 'Procedure Designed For Add New Record End If Exit Sub err_add: a = MsgBox("Error While Adding New Record(Error No." & Err & "), " & Err.Description, vbCritical, "Telephone Diary Error Message") End Sub 'Button For Moving To Next Record Private Sub cmdnext_Click() On Error GoTo err_nex Call tassign_false 'tassign_false:Disables All Text Boxes t = Adodc.Recordset.RecordCount 'Count Total No Of Records If Adodc.Recordset.AbsolutePosition + 1 <= t Then 'if not at last record move to next, because t is total no of records Adodc.Recordset.MoveNext Else a = MsgBox("No More Records", vbInformation, "Telephone Diary Information") 'if already last record End If Exit Sub err_nex: a = MsgBox("Error While Moving Next Record (Error No." & Err & "), " & Err.Description, vbCritical, "Telephone Diary Error Message") End Sub Mind Breakers Page 58 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

'Button For Moving To Previous Record Private Sub cmdprevious_Click() On Error GoTo err_prv Call tassign_false 'tassign_false:Disables All Text Boxes If Adodc.Recordset.AbsolutePosition - 1 > 0 Then 'if not at first record move to previous Adodc.Recordset.MovePrevious Else a = MsgBox("No More Records", vbInformation, "Telephone Diary Information") 'if already first record End If Exit Sub err_prv: a = MsgBox("Error While Moving Previous Record (Error No." & Err & "), " & Err.Description, vbCritical, "Telephone Diary Error Message") End Sub 'Button For Refresh Record Private Sub cmdrefresh_Click() On Error GoTo err_rfh 'frmmain.Adodc.LockType = adLockReadOnly Adodc.Refresh Call tassign_false Exit Sub err_rfh: a = MsgBox("Error While Refresh(Error No." & Err & "), " & Err.Description, vbCritical, "Telephone Diary Error Message") End Sub 'Button For Update,Run Only If Database Password Is Entered Private Sub cmdupdate_Click() On Error GoTo err_upd Call MDIForm1.chkdatapassword If MDIForm1.passval = 1 Then forupdate 'Procedure Designed For Update Record End If Call tassign_false 'tassign_false:Disables All Text Boxes Exit Sub err_upd: e = MsgBox("Error While Updating Record(Error No." & Err & "), " & Err.Description, vbCritical, "Telephone Diary Error Message") End Sub Mind Breakers Page 59 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic 'Private Sub txtfname_KeyPress(KeyAscii As Integer) 'comp = Chr(KeyAscii) Like "[A-Za-z ]" ' If comp = False Then ' KeyAscii = 0 ' End If 'End Sub 'Procedure For Updating Public Sub forupdate() Call tassign_true '-------------------------------------txtfname.Text = UCase(txtfname.Text) txtlname.Text = UCase(txtlname.Text) txtstate.Text = UCase(txtstate.Text) txtcity.Text = UCase(txtcity.Text) txtadd1.Text = UCase(txtadd1.Text) txtadd2.Text = UCase(txtadd2.Text) 'Convert Inputs Into Upper Case '--------------------------------------Adodc.Recordset.Update '*************************************** 'Automatically Add STD Code In The STD Databse If Not Yet Present If count_add_std = 1 Then 'Value 1 Mean STD Code Is Not In The Database Call auto_add_std 'Procedure Designed For Automatically New STD Code End If up = MsgBox("Record Updated Successfully", vbInformation, "Telephone Diary Information") 'Message Box Will Appear When Updation Complete cmdnew.SetFocus End Sub 'Procedure For Delete Public Sub fordelete() ask = MsgBox("Do You Realy Want To Delete Record", vbYesNo, "Telephone Diary") If ask = vbYes Then Adodc.Recordset.Delete Adodc.Recordset.MoveNext If Adodc.Recordset.EOF Then Adodc.Recordset.MoveLast End If ElseIf ask = vbNo Then frmmain.Show End If End Sub Mind Breakers Page 60 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic 'Procedure For Adding New Record Public Sub fornew() Call tassign_true 'tassign_true:Enables All Text Boxes Adodc.Recordset.AddNew txtfname.SetFocus 'Moves Cursor To First Name Text Box MDIForm1.passval = 1 End Sub Private Sub Form_Activate() Call MDIForm1.format_back_color Call MDIForm1.format_fore_color End Sub 'On Loading Of The Form Private Sub Form_Load() MDIForm1.mnudatabase.Checked = True 'Displays Sign Of Check In The MDIForm View Menu flag_count_move_first_click = 0 flag_count_move_last_click = 0 Call tassign_false Adodc.Refresh 'tassign_false:Disables All Text Boxes Unload frmshowall End Sub 'Procedure:Disables All Text Boxes Public Sub tassign_false() txtfname.Enabled = False txtlname.Enabled = False txtcity.Enabled = False txtstate.Enabled = False txtstdcode.Enabled = False txtph1.Enabled = False txtph2.Enabled = False txtph3.Enabled = False txtfax.Enabled = False txtemail.Enabled = False txtmobile.Enabled = False txtadd1.Enabled = False txtadd2.Enabled = False End Sub 'Procedure tassign_true:Enables All Text Boxes Public Sub tassign_true() txtfname.Enabled = True Mind Breakers Page 61 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic txtlname.Enabled = True txtcity.Enabled = True txtstate.Enabled = True txtstdcode.Enabled = True txtph1.Enabled = True txtph2.Enabled = True txtph3.Enabled = True txtfax.Enabled = True txtemail.Enabled = True txtmobile.Enabled = True txtadd1.Enabled = True txtadd2.Enabled = True End Sub 'Removes Sign Of Check From The MDIForm View Menu Private Sub Form_Unload(Cancel As Integer) MDIForm1.mnudatabase.Checked = False End Sub 'Procedure For Find Out Whether Currently At Last Record Or Not Public Sub count_position_last() c_p = Adodc.Recordset.RecordCount If Adodc.Recordset.AbsolutePosition + 1 <= c_p Then flag_count_move_last_click = 0 Else flag_count_move_last_click = 1 End If End Sub 'Procedure For Find Out Whether Currently At First Record Or Not Public Sub count_position_first() If Adodc.Recordset.AbsolutePosition - 1 > 0 Then flag_count_move_first_click = 0 Else flag_count_move_first_click = 1 End If End Sub '*********************************************************************** 'What Will Occur When Text Box Lose Focus 'Automatically Diaplays STD Code when You Entered City's Name 'else If City Not found in the database then add this to database Private Sub txtcity_LostFocus() count_add_std = 0 tval = Trim(UCase(txtcity.Text)) temp = 0 Mind Breakers Page 62 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic frmaddnewstd.Adodc1.Recordset.MoveFirst Do Until frmaddnewstd.Adodc1.Recordset.EOF If (frmaddnewstd.Adodc1.Recordset![ST_NAME] = tval) Then txtstdcode.Text = frmaddnewstd.Adodc1.Recordset![ST_STDCODES] Else temp = temp + 1 End If frmaddnewstd.Adodc1.Recordset.MoveNext Loop If temp = frmaddnewstd.Adodc1.Recordset.RecordCount Then count_add_std = 1 'if city not found then assign value=1 End If End Sub 'Check Whether e-mail entered in correct format or not Private Sub txtemail_LostFocus() On Error GoTo err_lstfocus 'if no input is made If Trim(txtemail.Text) = "" Then Call emailchecked 'if email format is correct ElseIf Trim(txtemail.Text) <> "" Then 'if input made Call chkemail 'Check email End If Exit Sub err_lstfocus: a = MsgBox("Error While During Operation(Error No." & Err & "), " & Err.Description, vbCritical, "Telephone Diary Error Message") End Sub 'Will Automatically Add The New City Or STD Code in Database Public Sub auto_add_std() Load frmaddnewstd 'form for adding new std codes '-------------------------------------frmaddnewstd.Adodc1.Recordset.AddNew frmaddnewstd.txtname = Trim(UCase(txtcity.Text)) frmaddnewstd.txtcode = Trim(txtstdcode.Text) frmaddnewstd.Adodc1.Recordset.Update 'controls in frmaddnewstd form----------Unload frmaddnewstd count_add_std = 0 End Sub

Mind Breakers

Page 63 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

'Run When No First Name And Last Name Is Entered Private Sub txtlname_LostFocus() If Trim(txtfname.Text) = "" Then ver = MsgBox("Blank Not Allowed Here,Enter First Name", vbCritical, "Telephone Diary Error") txtfname.SetFocus End If End Sub 'Run When No Phone Is Entered Private Sub txtph3_LostFocus() If Trim(txtph1.Text) = "" And Trim(txtph2.Text) = "" And Trim(txtph3.Text) = "" Then ph = MsgBox("No Phone Number Entered,Enter At Least One Phone One", vbCritical, "Telephone Diary Error") txtph1.SetFocus End If End Sub 'If STD Code Added Auomatically Then Cursor will Directly Move To Ph1 Private Sub txtstate_LostFocus() If Trim(txtcity.Text) <> "" And Trim(txtstdcode.Text) <> "" Then txtph1.SetFocus End If End Sub 'If STD Code And City Not Match With The Record In Databae 'Then This Will Add New Input To Database Private Sub txtstdcode_LostFocus() If Trim(txtstdcode.Text) = "" Or Trim(txtcity.Text) = "" Then ver = MsgBox("STD Code Not Found,Please Check City Name", vbCritical, "Telephone Diary Error") txtcity.SetFocus ElseIf Trim(txtstdcode.Text) <> "" Then tval = Trim(UCase(txtcity.Text)) tval1 = Trim(txtstdcode.Text) temp = 0 frmaddnewstd.Adodc1.Recordset.MoveFirst Do Until frmaddnewstd.Adodc1.Recordset.EOF If (frmaddnewstd.Adodc1.Recordset![ST_STDCODES] = tval1) And (frmaddnewstd.Adodc1.Recordset![ST_NAME] = tval) Then count_add_std = 0 Else temp = temp + 1 End If frmaddnewstd.Adodc1.Recordset.MoveNext Loop If temp = frmaddnewstd.Adodc1.Recordset.RecordCount Then Mind Breakers Page 64 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic count_add_std = 1 End If End If End Sub 'Procedure Check Whether email format is correct or not Public Sub chkemail() countemail = 0 'verify whether '.' present or not verified = 0 'verify whether '@' present or not d = Len(Trim(txtemail.Text)) For b = 1 To d a = Mid(txtemail.Text, b, 1) If (a = "@") Then verified = verified + 1 End If Next b If verified = 0 Or verified > 1 Then 'verify whether @ present single time or more msg1 = MsgBox("Invalid Format, Please Enter Correct e-mail ID(Use @Domain Name)", vbCritical, "Telephone Diary Error") txtemail.SetFocus ElseIf verified = 1 Then 'if @ present single time then check .com etc. For c = 1 To d aa = Mid(txtemail.Text, c, 1) If (aa = ".") Then countemail = countemail + 1 End If Next c If countemail = 0 Then 'shoe message if . not present msg1 = MsgBox("Invalid Format,Please Enter Correct e-mail ID(Use .com etc)", vbCritical, "Telephone Diary Error") txtemail.SetFocus ElseIf countemail >= 1 Then 'proceed if . not present Call emailchecked End If End If End Sub 'if email format is correct Public Sub emailchecked() mm = MsgBox("Apply Changes", vbYesNo, "Telephone Diary") If mm = vbYes Then forupdate ElseIf mm = vbNo Then Adodc.Recordset.CancelUpdate cntposition = Adodc.Recordset.AbsolutePosition Adodc.Refresh Adodc.Recordset.AbsolutePosition = cntposition Mind Breakers Page 65 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic End If tassign_false End Sub

Show All Records


frmshowall:- This window is for showing all the records present in the
database. On loading this window searches for all records in the databse and displays them in the same window. At the upper portion this window shows the total number of records in the database.

Mind Breakers

Page 66 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Coding:
'Form To Diplay All Records Dim rcd_count As Integer Public check_frmmain As Integer Private Sub Form_Activate() Call MDIForm1.format_back_color Call MDIForm1.format_fore_color End Sub Private Sub Form_Load() MDIForm1.mnushowall.Checked = True Call allrecords 'Call Of Procedure To Display All Records End Sub Private Sub Form_Unload(Cancel As Integer) MDIForm1.mnushowall.Checked = False '----------------------------------------If ckeck_frmmain = 1 Then frmmain.Adodc.Refresh Mind Breakers Page 67 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic ElseIf ckeck_frmmain = 0 Then Unload frmmain End If 'Unload Formmain If Not Loaded Before This Search End Sub 'Procedure Showing All Records Public Sub allrecords() Dim rcdcount As Integer rcd_count = 1 frmmain.Adodc.Recordset.MoveFirst Do Until frmmain.Adodc.Recordset.EOF display_data1 rcd_count = rcd_count + 1 frmmain.Adodc.Recordset.MoveNext Loop End Sub 'Procedure Adding Result To List Box Public Sub display_data1() vst_fname = frmmain.Adodc.Recordset![st_fname] vst_lname = frmmain.Adodc.Recordset![st_Lname] vst_city = frmmain.Adodc.Recordset![st_city] vst_state = frmmain.Adodc.Recordset![st_state] vst_ph1 = frmmain.Adodc.Recordset![st_ph1] vst_ph2 = frmmain.Adodc.Recordset![st_ph2] vst_ph3 = frmmain.Adodc.Recordset![st_ph3] vst_fax = frmmain.Adodc.Recordset![st_fax] vst_mobile = frmmain.Adodc.Recordset![st_mobile] vst_add1 = frmmain.Adodc.Recordset![st_add1] vst_add2 = frmmain.Adodc.Recordset![st_add2] vst_std = frmmain.Adodc.Recordset![st_std] vst_email = frmmain.Adodc.Recordset![st_email] frmshowall.Label1.Caption = "Total Numbers Of Records Are:" & frmmain.Adodc.Recordset.RecordCount 'frmmain.Hide frmshowall.List1.AddItem "(" & rcd_count & ")Name: " & vst_fname & " " & vst_lname frmshowall.List1.AddItem Space(4) & " Address: " & vst_add1 & ", " & vst_add2 frmshowall.List1.AddItem Space(4) & " City: " & vst_city & " State:" & vst_state & ", STD Code: " & vst_std frmshowall.List1.AddItem Space(4) & " Phone No. Shop: " & vst_ph1 & " Resi: " & vst_ph2 + " Other: " + vst_ph3 frmshowall.List1.AddItem Space(4) & " Fax: " & vst_fax & " Mobile No.: " & vst_mobile frmshowall.List1.AddItem Space(4) & " Email: " & vst_email frmshowall.List1.AddItem Space(4) & "-----------------------------------------------------------------------------------------------------------" End Sub Mind Breakers Page 68 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

'If No Record Found Public Sub record_not_found1() inkey = MsgBox("Sorry No Record Found In The Database.", vbOKOnly, "Telephone Diary Information") MDIForm1.Show End Sub

Add New ISD Code Window


frmaddnewisd:This window is for adding new ISD code in the database. This window will open only when correct password is entered.

Mind Breakers

Page 69 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Coding:
'Form For Adding New ISD Codes In The ISD Database '------------------------------------------------Private Sub Form_Deactivate() Unload Me End Sub 'used when cursor moves from ISD Code Box Private Sub txtcode_LostFocus() On Error GoTo err_lstfocus If Trim(txtname.Text) <> "" And Trim(txtcode.Text) <> "" Then 'Run Only If Both The Name & ISD Codes Are Present txtname = Trim(UCase(txtname.Text)) txtcode = Trim(txtcode.Text) msg = MsgBox("Do You Want To Update Record", vbYesNo, "Telephone Diary Message") ' Used For Adding Multiple Records By Message Box If msg = vbYes Then Adodc1.Recordset.Update Call fornew ElseIf msg = vbNo Then frmaddnewisd.Show txtname.SelLength = Len(txtname.Text) End If ElseIf Trim(txtname.Text) = "" Or Trim(txtcode.Text) = "" Then 'Run If Any of Name or ISD Codes is Absent msgverify = MsgBox("Please Enter Complete Information", vbCritical, "Telephone Diary Error") End If Exit Sub err_lstfocus: Mind Breakers Page 70 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic msgerr = MsgBox("Action Cancelled(Error No." & Err & "), " & Err.Description, vbCritical, "Telephone Diary Error Message") End Sub Public Sub fornew() msg2 = MsgBox("Do You Want To Add More Records", vbYesNo, "Telephone Dairy Message") If msg2 = vbYes Then Adodc1.Recordset.AddNew 'Adodc1 is the Control in frmaddnewisd form frmaddnewisd.Show txtname.SetFocus ElseIf msg2 = vbNo Then Unload Me End If End Sub

Add New STD Code Window


frmaddnewstd:- This window is for adding new STD code in the
database. This window will open only when correct password is entered.
Mind Breakers Page 71 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Coding:
'Form For Adding New STD Codes In The STD Database '------------------------------------------------Private Sub Form_Deactivate() Unload Me End Sub 'used when cursor moves from STD Code Box Private Sub txtcode_LostFocus() On Error GoTo err_lstfocus If Trim(txtname.Text) <> "" And Trim(txtcode.Text) <> "" Then 'Run Only If Both The Name & STD Codes Are Present txtname = Trim(UCase(txtname.Text)) txtcode = Trim(txtcode.Text) msg = MsgBox("Do You Want To Update Record", vbYesNo, "Telephone Diary Information") If msg = vbYes Then Adodc1.Recordset.Update Call fornew1 ElseIf msg = vbNo Then frmaddnewstd.Show txtname.SelLength = Len(txtname.Text) End If ElseIf Trim(txtname.Text) = "" Or Trim(txtcode.Text) = "" Then msgverify = MsgBox("Please Enter Complete Information", vbCritical, "Telephone Diary Error") 'Run If Any of Name or STD Codes is Absent End If Exit Sub err_lstfocus:

Mind Breakers

Page 72 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic msgerr = MsgBox("Action Cancelled(Error No." & Err & "), " & Err.Description, vbCritical, "Telephone Diary Error Message") End Sub Public Sub fornew1() msg2 = MsgBox("Do You Want To Add More Records", vbYesNo, "Telephone Dairy Message") If msg2 = vbYes Then Adodc1.Recordset.AddNew 'Adodc1 is the Control in frmaddnewstd form frmaddnewstd.Show txtname.SetFocus ElseIf msg2 = vbNo Then Unload Me End If End Sub

Other Forms
Change Password
Mind Breakers Page 73 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

frmchangepass:-

This form is designed to change the password. With the help of this we can change the startup password and database password.

Coding:
Private Sub cmdcancel_Click(Index As Integer) Unload Me End Sub Private Sub cmdOK_Click(Index As Integer) old_pass = UCase(Trim(txtoldpass.Text)) If txtnewpass.Text <> "" And txtretypepass.Text <> "" Then If changelbl.Caption = "Change StartUp Password" Then 'txttmp1.Text = UCase(Trim(txtnewpass.Text)) ADODCPASS.Recordset.MoveFirst If Trim(txttmp1.Text) <> old_pass Then 'ADODCPASS.Recordset![opentd] <> old_pass Then aa1 = MsgBox("Invalid Old Password", vbCritical, "Invalid Password") txtoldpass.Text = "" txtoldpass.SetFocus ElseIf Trim(txttmp1.Text) = old_pass Then If UCase(Trim(txtnewpass.Text)) = UCase(Trim(txtretypepass.Text)) Then ADODCPASS.Refresh ADODCPASS.Recordset.MoveFirst Mind Breakers Page 74 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic txttmp1.Text = UCase(Trim(txtnewpass.Text)) ADODCPASS.Recordset![opentd] = UCase(Trim(txtnewpass.Text)) ADODCPASS.Recordset.Update aa = MsgBox("Password Has Been Changed Sucussfully", vbOKOnly, "Password Changed") Unload Me ElseIf UCase(Trim(txtnewpass.Text)) <> UCase(Trim(txtretypepass.Text)) Then aa2 = MsgBox("New Password & Retype Password Don't Match", vbCritical, "Different Passwords") txtnewpass.Text = "" txtretypepass.Text = "" txtnewpass.SetFocus End If End If End If '********************************************************** If changelbl.Caption = "Change Database Password" Then ADODCPASS.Recordset.MoveFirst If Trim(txttmp2.Text) <> old_pass Then 'ADODCPASS.Recordset![opentd] <> old_pass Then aa1 = MsgBox("Invalid Old Password", vbCritical, "Invalid Password") txtoldpass.Text = "" txtoldpass.SetFocus ElseIf Trim(txttmp2.Text) = old_pass Then If UCase(Trim(txtnewpass.Text)) = UCase(Trim(txtretypepass.Text)) Then ADODCPASS.Refresh ADODCPASS.Recordset.MoveFirst txttmp2.Text = UCase(Trim(txtnewpass.Text)) ADODCPASS.Recordset![Database] = UCase(Trim(txtnewpass.Text)) ADODCPASS.Recordset.Update aa = MsgBox("Password Has Been Changed Sucussfully", vbOKOnly, "Password Changed") Unload Me ElseIf UCase(Trim(txtnewpass.Text)) <> UCase(Trim(txtretypepass.Text)) Then aa2 = MsgBox("New Password & Retype Password Don't Match", vbCritical, "Different Passwords") txtnewpass.Text = "" txtretypepass.Text = "" txtnewpass.SetFocus End If End If End If '********************************************************** Else aa3 = MsgBox("Given Information Is Not Complete", vbCritical, "Not Complete Information") End If End Sub Mind Breakers Page 75 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

Private Sub Form_Load() End Sub Private Sub txtnewpass_LostFocus() txtretypepass.SetFocus End Sub

About Telephone Diary


Mind Breakers Page 76 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

frmabouttd:Telephone Diary.

This window is for providing brief introduction of

Coding:
'Form For Providing Information About Telephone Diary '----------------------------------------------------Private Sub cmdOK_Click() Unload Me End Sub Private Sub Form_Deactivate() Unload Me End Sub

Output Window
Mind Breakers Page 77 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

frmoutput:- This is one of the main windows of this project. When we use
Advance Search then the output of search will be displayed in this window.

Coding:
Private Sub Form_Activate() Call MDIForm1.format_back_color Call MDIForm1.format_fore_color End Sub Private Sub Form_Unload(Cancel As Integer) Load frminput frminput.Show frminput.txtinput.Text = "" frminput.txtinput.SetFocus End Sub

About Me Window
Mind Breakers Page 78 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

frmaboutme:- This window gives you the information about me. This
window is based on animation. In this window timer is used to show information about me in the form of animation.

Coding:
'Form For Providing Information About Me i.e. Sandeep Gupta '---------------------------------------------------------Public Sub san() cnt = 0 Do Until cnt = 100000 '500000 ' cnt = cnt + 1 Loop End Sub Private Sub Label10_Click() Unload Me End Sub Private Sub Form_Deactivate() Unload Me End Sub Private Sub Timer1_Timer() Mind Breakers Page 79 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic Static s As Integer '-------------------------------------------------'move right Do Until Image1.Left >= 5620 And Image1.Top = 0 Label11(0).Visible = True a=1 Do Until a = 18 Image1.Move Image1.Left + 380 If s Then Image1.Picture = Image3.Picture Else Image1.Picture = Image5.Picture End If Label11(a).Visible = True a=a+1 s = Not s Call san If a = 7 Then Line1.Visible = True ElseIf a = 13 Then Line2.Visible = True ElseIf a = 18 Then Line3.Visible = True End If Loop Label11(18).Visible = True Loop Image6(1).Visible = True '-----------------------------------------------------'move down Image1.Left = 6000 Do Until Image1.Top >= 1050 'And Image1.Left <= 6000 Image1.Move Image1.Left + 0, Image1.Top + 80 If s Then Image1.Picture = Image33.Picture Else Image1.Picture = Image55.Picture End If s = Not s Call san Loop '-----------------------------------------------------'move left side age1 = 0 age2 = 2 Do Until Image1.Left <= 150 Image1.Move Image1.Left - 380, Image1.Top + 0 Mind Breakers Page 80 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic If s Then Image1.Picture = Image333.Picture Else Image1.Picture = Image555.Picture End If If age1 <= 3 Or age2 <= 9 Then age(age1).Visible = True age(age2).Visible = True age1 = age1 + 1 age2 = age2 + 1 End If s = Not s Call san If age2 = 8 Then Line4.Visible = True ElseIf age2 = 9 Then Line10.Visible = True End If Loop Image7.Visible = True Label1.Visible = True '--------------------------------------------------------'move down Do Until Image1.Top >= 2200 Image1.Move Image1.Left + 0, Image1.Top + 80 If s Then Image1.Picture = Image33.Picture Else Image1.Picture = Image55.Picture End If s = Not s Call san Loop '-----------------------------------------------------'Move Right quali1 = 0 quali2 = 14 Do Until Image1.Left >= 5900 Image1.Move Image1.Left + 380, Image1.Top + 0 If s Then Image1.Picture = Image3.Picture Else Image1.Picture = Image5.Picture End If If quali1 <= 13 Or quali2 <= 29 Then quali(quali1).Visible = True quali(quali2).Visible = True Mind Breakers Page 81 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic quali1 = quali1 + 1 quali2 = quali2 + 1 End If s = Not s Call san If quali2 = 20 Then Line5.Visible = True ElseIf quali2 = 25 Then Line6.Visible = True 'ElseIf quali2 = 29 Then 'Line7.Visible = True End If Loop '--------------------------------------------------------'move down Do Until Image1.Top >= 3720 Image2.Visible = True Image1.Move Image1.Left + 0, Image1.Top + 80 If s Then Image1.Picture = Image33.Picture Else Image1.Picture = Image55.Picture End If s = Not s Call san Loop '-----------------------------------------------------'move left side mail1 = 0 mail2 = 7 Do Until Image1.Left <= 150 Image1.Move Image1.Left - 380, Image1.Top + 0 If s Then Image1.Picture = Image333.Picture Else Image1.Picture = Image555.Picture End If If mail1 <= 6 Or mail2 <= 17 Then mail(mail1).Visible = True mail(mail2).Visible = True mail1 = mail1 + 1 mail2 = mail2 + 1 End If s = Not s Call san If mail2 = 15 Then Mind Breakers Page 82 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic Line8.Visible = True ElseIf mail2 = 17 Then Line9.Visible = True End If Loop Image4.Visible = True Call forstop End Sub Public Sub forstop() Image1.Visible = False Timer1.Enabled = False End Sub

Format Window
frmformat:This window is invisible in nature. This is designed for maintaining and changing the fore colours and back colours at backend.

S.NO

BOOK NAME

PUBLISHERS

Mind Breakers

Page 83 of 84

The Project Report Is Created By MIND BREAKERS Team of Mehr Chand Polytechnic

1 2 3 4

TEACH YOURSELF VISUAL BASIC 6.0 IN 24 HOURS EVENT PROGRAMMING WITH VISUAL BASIC 6.0 VISUAL BASIC INTRODUCTION TO DATABASE WITH ACCESS

(TECHMEDIA) (APTECH LIMITED) (MAHE, MANIPAL) (MAHE, MANIPAL)

Mind Breakers

Page 84 of 84

Вам также может понравиться