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

SOFTWARE FOR IN

VISUAL BASIC 6.0

A PROJECT REPORT
SUBMITTED TO PUNJAB TECHNICAL UNIVERSITY, JALANDHAR FOR THE PARTIAL FULFILMENT OF THE REQUIREMENTS OF MASTER IN COMPUTER APPLICATION LETARAL ENTRY (UNDER DISTANCE EDUCATION PROGRAMME)

SUPERVISED BY: Parminder Singh

SUBMITTED BY: Kirandip kaur Sandeep sharama

PREFACE
The Journey of a thousand miles starts with a single step. This project is the first milestone in the journey of our technical experience. Throughout the on going of this project, we usually got nervous but the only thing that kept us going on were the words of Swami Dayanand Saraswati. No need of looking behind, forward! We want infinite energy, infinite zeal Infinite courage and infinite patience Then only will great things be achieved The information highway has brought an era where intricate problems are being solved in a fraction of second. The present age is The age of computers. The computer technology has entered into every walk of life. The increasing number of computers can be seen employed in offices, hospitals, railways and a lot more places. Computers not only allow the enhancement in computation speed but also have brought in considerable cost effectiveness. It is important to develop a correlation between the practical and theoretical aspects of the subject studied. It is more relevant in the field of computers. Thus in order to test, implement and use the various techniques studied, this project called COMPUTER BASED ICICI BANK SYSTEM was taken up that has innumerable advantages over manual system.
Barjinder Singh Jatinder Singh Prithipal Singh

ACKNOWLEDGEMENT
THANKS TO THE ALMIGHTY FOR SHOWERING HIS BLESSINGS

Nothing concrete can be achieved without a combination of inspiration and perspiration. Although writing a few words on a piece of paper is not a proper way of acknowledge those people who has helped us in the completion of this project, yet the words coming from our heart and soul need no mode of communication.
I take the opportunity to present my vote of thanks to all those guideposts who really acted as lighting pillars to enlighten my way throughout this project that has led to completion of this study. I find it a matter of honor in showering my gratitude, indebt-ness and thankfulness to my Guide respected Prof. Parminder Singh for her utmost interest, kind and invaluable guidance and during the project supporting me , gently coaxing me, giving me vital push and instilling sense of urgency which led to successful completion of this project.. I will be failing our duties if I dont thank and acknowledge Harbhajan Singh for providing me construction guidance, labs facility and high moral support throughout me working phase. I debited to both for lending their helping hand whenever the need arose, due to which this project was possible. I offer appreciation to our parents and friends for there willing cooperation, encouragement, moral and financial support. I thank all the people who helped us directly or indirectly in this project. Last but not least, I feel very honored to complete this project as students their guidance and providing me

CERTIFICATE
TO WHOM IT OUR CONCERN
This is to certify that the project report entitled HOSPITAL MANAGEMENT SYSTEM submitted for the award of BSCT is a research work carried out by Kirndip Kaur Sandip Shama under our supervision. This is an original piece of work and has not been submitted for any other degree to this or any other University or institute. The assistance and help during the course of investigation has been fully acknowledged.

Supervisor: Prof. Parminder Singh (Lecturer in Computer Department) IPS INFOTECH, JANDIALA GURU. Affiliated by P.T.U ,JALANDHAR,

CANDIDATE DECLARATION

I swear that this project is an authentic work presented by me in favour of PUNJAB TECHNICAL UNIVERSITY JALANDHAR. All the information in his report is true and best to our knowledge. No part of this project has been copied from any project presented by someone for any degree of course.

Kirndip Kaur Sandip Sharma

INDEX

-------------------------------------------------------------------------------------------------------------NO. CONTENTS -------------------------------------------------------------------------------------------------------------1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. INFORMATION SUPPLIED BY P.S.E.B PROPOSED SYSTEM REQUIREMENT DETERMINATION SYSTEM ANALYSIS SYSTEM DESIGN IMPLEMENTATION AND TESTING ABOUT VISUAL BASIC 6.0 DATA BASE FORMS CODING REPORTS CONCLUSION

INFORMATION SUPPLIED BY
PUNJAB STATE ELECTRICITY BOARD

INTRODUCTION

INTRODUCTION
Punjab State Electricity Board being monoplous in the distribution and billing of electricity in Amritsar. Categories of consumers are as under:
1. Domestic Electricity Supply 2. Commercial Electricity Supply

Procedure of billing in Punjab State Electricity Board is: These different categories of consumer are supplied bills according to tariff. Separate tariff rates are applied for different categories of consumer. At present billing are done both manually and through the computer. One cycle for the purpose of billing equals two month i.e. billing is being done manually. The various jobs like taking new reading on the previous reading, return of completed meter books, the premises return of stubs, ledger printing and generation of reports are sequential in nature and the sequences has to be followed strictly. Initially the meter reader visits the consumer to note the meter reading. Date for reading and other information like status etc. these reading dully filled on meter books are returned to electricity dept. next taking into account plus any advises, which denote unusual changes, that may have come up during the due course of time to various forms, bills for current cycle are generated. The bills are distributed through bill distributed to the consumer at there homes.

The consumer makes the payment vaying amount against the bill at cash window mentioned for payment. The cash-receiving clerk at the cash window issues the receipts for the same amount. The stubs, which contains information like amount paid, and date are retained by the C.R.C. all the stubs are collected and on their bases ledger generation for each consumer takes place. Then the reports like amount collected date wise, division wise and sub division wise etc. are generated. From various reports the summary is generated which is required for management purpose.

PAYMENT
Payment for commercial and domestic the above rates are net. In the event of monthly billing not being paid within the date specified in the bill, the surcharge of 10% shall be levied on unpaid amount of the bill in the first instance and this would further continued to be levied every year. The best way to study the above mentioned procedure is to segregate them into following various hands.

SCHEDULE DOMESTIC ELECTRICITY SUPPLY TARIFF The rate for domestic connection is rs.1.20 per unit. This is applicable for the entire consumption.

METER RENT Meter rent is being charged by PSEB from the consumer. The meter rent for domestic connection is rs.11 per month. Meter rent is not being charged from the consumer who supply meter of his or her own.

SURCHARGE Surcharge is being charged by P.S.E.B. it is being charged to cover up any sudden charges in the rate of tariff. P.S.E.B. charges 10% of the total amount from the consumer.

MISLLINOUS CHARGES Minimum charges or sundry charges mean monthly payment.

SCHDULE COMMERCIAL ELECTRICITY SUPPLY

TARIFF The rate for commercial is rs.2.50 per unit. This is applicable for the entire consumption.

METER RENT Meter rent is being charged by PSEB from the commercial sector. The meter rent for domestic connection is rs.15 per month. Meter rent is not being charged from the consumer who supply meter of his or her own.

SURCHARGE Surcharge is being charged by P.S.E.B. it is being charged to cover up any sudden charges in the rate of tariff. P.S.E.B. charges 10% of the total amount from the consumer. MISLLINOUS CHARGES Minimum charges or sundry charges mean monthly payment.

PROPOSED SYSTEM

PROPOSED SYSTEM A profound study of the existing system together with its limitations left only computerization a viable solution. The prime reason bang that computer is capable of processing large amount of data at high speed. Most data can be stored in small space for years together without any trouble and can be retrieved in few seconds. In the proposed systems we provide all necessary computer facility for computerize billing of elec. Department. The major advantages of the purposed system are:
1. Accuracy will be highly enhanced. This can be expected because there is

negligible chances of error in commuter computations and all manually entered data will be check listed before use. 2. Data storage will become much easy. 3. The system being menu driven and can be used with little effort even by strangers to computers. 4. A lot of computational burden will be off from the elec. Dept. 5. Report and bill can be made available on the time, which is must for them.

REQUIREMENT
DETERMINATION

REQUIREMENT DETERMINATION

A candidate system is designed to meet the user needs. The first step of cycle is to determine the requirement by carrying out a preliminary survey of initial investigation. Shared complete and accurate information requirements are essential in building computer-based info. System. Unfortunately determining the info each user needs is a particularly difficult task. Infect it is recognized one of the most difficult task in the system development. The info analyst determines needs of the user and the info flow that will satisfy those needs. There are different methods of determining requirements. These are as follows. 1. Getting info from existing system: - determining requirements from existing system has been called the data analyses. This strategy simply asks the user that what info is currently received and what other info is required. 2. Asking: - this strategy obtains info from users by simply asking them about the requirements. There are different asking methods like brainstorming is a technique used for generating new ideas and obtaining general info requirement.

SYSTEM
ANALYSIS

THE SYSTEM CONCEPT


The term System is derived from the Greek word System which means an organized relationship among functioning units or components. A system exists because it is designed to achieve one or more objectives. A system is an orderly grouping of interdependent component linked together according to a plan to achieve a specific objective. The word Component may refer a physical part, managerial steps or a sub system in a multilevel structure. System analysis and design for the information system were founded in the general system theory, which emphasizes a close look to all parts of a system. In most cases, system analysts operate in a dynamic environment where change is a way of life. To reconstruct a system the following key Elements must be considered:1. Outputs and inputs. 2. Processor(s). 3. Control. 4. Feedback. 5. Environment. 6. Boundaries and interface. OUTPUTS AND INPUTS A major objective of a system is to produce an output that has a value to its intended user. What ever be the nature of the output it must be in a line with the expectations of the intended user. Inputs are the elements that enter the system for processing. PROCESSOR(S) The processor is the element of a system that involves the actual transformation of input into output. CONTROL

The control element guides the system. It is the decision- making subsystem that controls the pattern of activities governing input, processing and output. FEEDBACK Control in dynamic system is achieved by feedback.. Feedback measures Output against a standard in some form of cybernetic procedure that includes communication and control. ENVIRONMENT The environment is the supra-system within which an organization operates. BOUNDARIES AND INTERFACE A system should be defined by its boundaries- the limits that identify its components, processes and interrelationships when it interfaces with another system. System analysis used here is the application of the system approach to the study and solution of the problems using computer-based system. System thinking is integral to system interrelated interlocking subsystem. The system approach is a way of thinking about the analysis and a design of computer based application. It provides a frame work visualizing the system. When a computer is introduced into an organization, various functions and dysfunction operate on users as well as organization. System analysis and design focus on systems, processes and technology.

SYSTEM ANALYSES

So the most important and critical process for the development of info system. System analyses means probing the problem and breaking it to several component so that a logical repackaging can be evolved. System analyses involve survey study definition and evolution phase of the problem.

SYSTEM STUDY Electricity Department being monopoles in the distribution and billing of elect categorize. Its industrial consumers are 1. 2. Large Industrial Electricity Supply Small Industrial Electricity Supply

Other consumer classes are:


1. 2.

Domestic Supply Commercial Supply

The system concerns with the billing of small industrial elect supply of the above mentioned super system.

SYSTEM DESIGN Here logical design of system is developed. The inputs to the system design phase are functional specification of the system and details about the computer configuration. During this phase:

1. Logic of the program is designed, files or databases are designed and program test plans and implementation plans are drawn up. 2. Finally an estimate of the effect of candidate system on user and organization are documented and evaluated by the management as the first step towards the implementation. 3. The fail report before the implementation includes procedural flow charts, record layout, report layout and workable plane for implementing the candidate system

SYSTEM DESIGN

THE SYSTEM DEVELOPMENT LIFE CYCLE


To understand system development, we need to recognize that a candidate system that has a life cycle. System analysis and design are keyed to the system life cycle. The stages of system development life cycle are shown below: Recognition of Need Feasibility Study Analysis Design Implementation Post Implementation and Maintenance The analyst must progress from onstage to another methodically, answering key questions and achieving results in each stage. There can easily be overlap during any phase of the cycle. We now describe each of these steps.

Hardware Requirements
1. 2. 3. 4. 5. 6. 7. 8. System Speed Hard Disk RAM Keyboard Printer Monitor Floppy Disk Drive Pentium-II or above 433 MHz 2 GB 64 MB 108 Key HP 3325 LG 1.44 MB

Software requirements
1. 2. Operating System Software Windows 98 or higher version Oracle 8i & VB 6.0

IMPLEMENTATION AND TESTING

IMPLEMENTATION AND TESTING PROCESSING LOGIC

By the end of detailed study of file design the following info was available:Objectives from the new system derived from the limitations of the system. A definition of the user community on the system. A logical model of the proposed system with logical specification for each basic process at the appropriate level of details also the various data definitions. Complete file designing of the proposed system with a special input output formats.

ORGANISATIONAL OBJECTIVES AND SYSTEM OBJECTIVES The organizational objectives being to add accuracy and to cut time delays in billing and reporting plus to reduce workload of computations.

THE SYSTEM OBJECTIVES ARE CLASSIFIED AS FOLLOWS: 1. The databases should be totally exhaustive and redundancy is to be avoided. 2. The system should be properly divided into modules so that each can be changed according to requirement. The system has to be flexible enough to accommodate a lot many changes feed backs expected after its practical running. 3. All the information regarding tariff rates as applicable to various categories are to be initialized via separate file. The numerals must be integrated into programming modules to facilitate changes as and when required.

ABOUT VISUAL BASIC 6.0

Microsoft Visual Basic 6.0, the fastest and easiest way to create applications for Microsoft Windows. Whether you are an experienced professional or brand new to Windows programming, Visual Basic provides you with a complete set of tools to simplify rapid application development. So what is Visual Basic? The "Visual" part refers to the method used to create the graphical user interface (GUI). Rather than writing numerous lines of code to describe the appearance and location of interface elements, you simply add pre-built objects into place on screen. Although writing programs can be tedious chore at times, VISUAL BASIC reduces the effort required on your part and makes programming as simple as dragging graphic objects onto your screen with your mouse. If you've ever used a drawing program such as Paint, you already have most of the skills necessary to create an effective user interface. The "Basic" part refers to the BASIC (Beginners All-Purpose Symbolic Instruction Code) 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 contains several hundred statements, functions, and keywords, many of which relate directly to the Windows GUI. Beginners can create useful applications by learning just a few of the keywords, yet the power of the language allows professionals to accomplish anything that can be accomplished using any other Windows programming language. The Visual Basic programming language is not unique to Visual Basic. The Visual Basic programming system, Applications Edition included in Microsoft Excel, Microsoft Access, and many other Windows applications uses the same language. The Visual Basic Scripting Edition (VBScript) is a widely used scripting language and a subset of the Visual Basic language.

Whether your goal is to create a small utility for yourself or your work group, a large enterprise-wide system, or even distributed applications spanning the globe via the Internet, Visual Basic has the tools you need.

Data access features allow you to create databases, front-end applications, and scalable server-side components for most popular database formats, including Microsoft SQL Server and other enterprise-level databases. ActiveX technologies allow you to use the functionality provided by other applications, such as Microsoft Words word processor, Microsoft Excel spreadsheet, and other Windows applications. You can even automate applications and objects created using the Professional or Enterprise editions of Visual Basic. Internet capabilities make it easy to provide access to documents and applications across the Internet or intranet from within your application, or to create Internet server applications. Your finished application is a true .exe file that uses a Visual Basic Virtual Machine that you can freely distribute.

Visual Basic Editions


Visual Basic is available in three versions, each geared to meet a specific set of development requirements.

The Visual Basic Learning edition allows programmers to easily create powerful applications for Microsoft Windows and Windows NT. It includes all intrinsic controls, plus grid, tab, and data-bound controls. The Professional edition provides computer professionals with a full-featured set of tools for developing solutions for others. It includes all the features of the Learning edition, plus additional ActiveX controls, the Internet Information Server Application Designer, integrated Visual Database Tools and Data Environment, Active Data Objects, and the Dynamic HTML Page Designer The Enterprise edition allows professionals to create robust distributed applications in a team setting. It includes all the features of the Professional edition, plus Back Office tools such as SQL Server, Microsoft Transaction Server, Internet Information Server, Visual SourceSafe, SNA Server, and more.

Visual Basic 6.0 has many powerful features that are required in todays programming environment, which include features from the previous versions. Some of these features are: PROGRAMMING OBJECTS AND EVENTS The visual forms and objects like list boxes and radio buttons that you use on the forms, help you to interact with the application in order to find out the flow of the program. The forms and objects perform a specified action when an event occurs. This is known as event-driven programming. A COMMON PROGRAMMING PLATFORM ACROSS ALL MICROSOFT OFFICE APPLICATIONS Almost all Microsoft Office applications support Visual Basic by sharing and reusing code across applications. NATIVE CODE COMPILATION One of the most significant features of Visual Basic is the native code compilation. This compilation produces code almost 20 times faster than pseudo code compilation.

32-BIT SUPPORT Visual Basic supports 32-bit applications. A QUICK AND EASY WAY TO DEVELOP APPLICATION The tools provided by Visual Basic help you reduce development time. It is faster to create applications using the tools available. WIZARDS Visual Basic includes many wizards that can automate tasks or even automate coding. Visual Basic 6.0 has a new collection of wizards to perform some difficult and routine tasks. Some of these are: The Package and Deployment Wizard The Class Builder Utility Data Object Generator Wizard The Add-In Designer The Application Wizard

OBJECT TYPES New object types, called File System Objects or FSO, have been added to Visual Basic 6.0.These objects enable you to work faster and more easily with files and directories. FUNCTIONS

There are fourteen additional functions in Visual Basic 6.0. All of them deal with string data. Some of these are Cal Byname, Filter, Format Currency, Format Date Time, Format Number & Format Percent. ACTIVEX FEATURES Visual Basic allows you to migrate applications to an ActiveX document, which enables the application to install and run from a Web browser. Thus, the developer need not know languages like Java or HTML. Visual Basic also enables you to create ActiveX controls. New ActiveX controls have been added and some of the existing controls have been enhanced in Visual Basic 6.0, which you will learn in the sections covered later. DATABASE ENHANCEMENTS Earlier versions of Visual Basic used Data Access Objects (DAO) and Remote Data Objects (RDO). Visual Basic 6.0 includes ActiveX Data Objects (ADO) as the visual data access tool, which will be covered in detail in a later section. Data access features allow you to create databases and front-end applications for most popular database formats, including Microsoft SQL Server and other enterprise-level databases. ADO requires very little coding to interact with a data source. SDI/MDI/EXP1ORER-STYLE INTERFACE OPTIONS

Visual Basic has the functionality to create single, multiple, or Windows Explorer-style document interface applications.

AN N-TIER ARCHITECTURE The traditional client/server architecture included two parts, also called tiers the client and the server. Today you have n-tier client/server, which includes more than two tiers. The applications using an n-tier architecture can be divided into a minimum of three parts, namely interface, business logic, and database functions. The client and the server handle the processing and the middle layer takes care of the business logic.

USER INTERFACE AND NAVIGATION It provides a graphical interface for you to interact with the application, view results of requests, manipulate and format the data once it is received by the client. BUSINESS LOGIC This is the second tier, which captures the rules that govern the application processing, and connects the user with the data.

DATA SERVICES

This tier manages and provides access to application data from a structured or an unstructured store. QUICK EDITING, TESTING, AND DEBUGGING The Visual Basic development environment includes extensive editing and debugging tools. INTERNET FEATURES Serverside applications, responding to user requests from a browser, can be written with the help of 115 applications. The methods, properties, and events of every element on a Web page can be exposed using the Dynamic HTML technology. Without having to transfer processing to the server, this technology also allows you to write Visual Basic codes to respond to actions on an HTML page. Applications can be easily distributed onto the Web using the Package and Deployment Wizard. If you need to program in a Visual Basic programming model, and not in DHTML or IIS, you can use ActiveX documents. These can also be used when you want to control the browser window, with all its additional parts. You can add toolbars, menus, and scroll bars of your choice using ActiveX controls. Special controls that have Internet-related functionality are the Internet Transfer Control, the Web Browser control, and the WinSock control. PACKAGE AND DEPLOYMENT WIZARD

The Package and Deployment Wizard, previously called Setup Wizard, has been enhanced to include a wider range of data access formats like ADO, DAO, ODBC, and RDO. A Visual Basic project is compressed into a .cab file or an executable setup program. The package can be deployed on a distribution site, like the Internet server, or just moved to a local or Network folder.

INTEGRATED DEVELOPMENT ENVIRONMENT The working environment in Visual Basic is often referred to as the integrated development environment or IDE because it integrates many different functions such as design, editing, compiling, and debugging within a common environment. In most traditional development tools, each of these functions would operate as a separate program, each with its own interface
INTEGRATED DEVELOPMENT ENVIRONMENT ELEMENTS

The Visual Basic integrated development environment (IDE) consists of the following elements. Menu Bar Toolbars Project Explorer Window Object Browser Code Editor Window Context Menus Toolbox Properties Window Form Designer Form Layout Window

Immediate, Locals, and Watch Windows

Forms, Controls, and Menus

The first step to creating an application with Visual Basic is to create the interface, the visual part of the application with which the user will interact. Forms and controls are the basic building blocks used to create the interface; they are the objects that you will work with to build your application. Forms are objects that expose properties which define their appearance, methods which define their behavior, and events which define their interaction with the user. By setting the properties of the form and writing Visual Basic code to respond to its events, you customize the object to meet the requirements of your application. Controls are objects that are contained within form objects. Each type of control has its own set of properties, methods and events that make it suitable for a particular purpose. Some of the controls you can use in your applications are best suited for entering or displaying text. Other controls let you access other applications and process data as if the remote application was part of your code. Designing a Form Form objects are the basic building blocks of a Visual Basic application, the actual windows with which a user interacts when they run the application. Forms have their own properties, events, and methods with which you can control their appearance and behavior. The first step in designing a form is to set its properties. You can set a form's properties at design time in the Properties window or at run time by writing code. Setting Form Properties Many of a form's properties affect its physical appearance. The Caption property determines the text that is shown in the form's title bar; the Icon property sets the icon that is displayed when a form is minimized. The MaxButton and MinButton properties determine whether the form can be maximized or minimized. By changing the BorderStyle property, you can control the resizing behavior of the form.

Height and Width properties determine the initial size of a form; Left and Top properties determine the form's location in relation to the upper left-hand corner of the screen. The WindowState property can be set to start the form in a maximized, minimized, or normal state. The Name property sets the name by which you will refer to the form in code. By default, when a form is first added to a project, its name is set to Form1, Form2, and so forth. It's a good idea to set the Name property to something more meaningful, such as "frmEntry" for an order entry form. The best way to familiarize you with the many form properties is to experiment. Change some of the properties of a form in the Properties window , then run the application to see their effect. You can learn more about each property by selecting it and pressing F1 to view the context-sensitive Help.

CONTROLS
LABEL

A Label control is a graphical control you can use to display text that a user can't change directly. You can write code that changes the text displayed by a Label Control in response to events at Run Time. For example, if your application takes a few minutes to commit a change, you can display a processing-status message in a Label. You can also use a Label to identify a control, such as a TextBox control, that doesn't have its own Caption property. Set the AutoSize and WordWrap properties if you want the Label to properly display variable-length lines or varying numbers of lines.

TEXTBOX
To display multiple lines of text in a TextBox control, set the MultiLine property to True. If a multiple-line TextBox doesn't have a horizontal scroll bar, text wraps automatically even when the TextBox is resized. To customize the scroll bar combination on a TextBox, set the ScrollBars property. Scroll bars will always appear on the TextBox when its MultiLine property is set to True, and its ScrollBars property is set to anything except None (0). If you set the MultiLine property to True, you can use the Alignment property to set the alignment of text within the TextBox. The text is left-justified by default. If the MultiLine property is False, setting the Alignment property has no effect.

COMBO BOX
A combo box control combines the features of a text box and a list box. This control allows the user to select an item either by typing text into the combo box, or by selecting it from the list.

Combo boxes present a list of choices to the user. If the number of items exceeds what can be displayed in the combo box, scroll bars will automatically appear on the control. The user can then scroll up and down or left to right through the list The easiest way to allow the user to interact with an application is to provide a button to click. You can use the command button control provided by Visual Basic, or you can create your own "button" using an image control containing a graphic, such as an icon. The command button control is used to begin, interrupt, or end a process. When clicked, it invokes a command that has been written into its Click event procedure. Most Visual Basic applications have command buttons that allow the user to simply click them to perform actions. When the user chooses the button, it not only carries out the appropriate action, it also looks as if it's being pushed in and released and is therefore sometimes referred to as a push button

CHECKBOX
A CheckBox control displays an X when selected; the X disappears when the CheckBox is cleared. Use this control to give the user a True/False or Yes/No option. You can use CheckBox controls in groups to display multiple choices from which the user can select one or more. You can also set the value of a CheckBox programmatically with the Value property. CheckBox and OptionButton controls function similarly but with an important difference: Any number of CheckBox controls on a form can be selected at the same time. In contrast, only one OptionButton in a group can be selected at any given time. To display text next to the CheckBox, set the Caption property. Use the Value property to determine the state of the controlselected, cleared, or unavailable.

OPTION BUTTON
Option buttons present a set of two or more choices to the user. Unlike check boxes, however, option buttons should always work as part of a group; selecting one option button immediately clears all the other buttons in the group. Defining an option button group tells the user, "Here is a set of choices from which you can choose one and only one." For example, in the option button group shown in Figure 3.11, the user can select one of three option buttons.

FRAME
A Frame control provides an identifiable grouping for controls. You can also use a Frame to subdivide a form functionallyfor example, to separate groups of OptionButton controls. To group controls, first draw the Frame control, and then draw the controls inside the Frame. This enables you to move the Frame and the controls it contains together. If you draw a control outside the Frame and then try to move it inside, the control will be on top of the Frame and you'll have to move the Frame and controls separately. To select multiple controls in a Frame, hold down the CTRL key while using the mouse to draw a box around the controls.

ActiveX Controls
ActiveX controls, formerly called OLE controls, are standard user interface elements that allow you to assemble forms and dialog boxes rapidly. ActiveX controls also bring the Internet alive, adding compelling new functionality to World Wide Web pages.

An ActiveX control is an extension to the Visual Basic Toolbox. You use ActiveX controls just as you would any of the standard built-in controls, such as the CheckBox control. When you add an ActiveX control to a program, it becomes part of the development and run-time environment and provides new functionality for your application. ActiveX controls leverage your capabilities as a Visual Basic programmer by retaining some familiar properties, events, and methods, such as the Name property, which behave as you would expect. Then, however, the ActiveX controls feature methods and properties that greatly increase your flexibility and capability as a Visual Basic programmer. For example, the Visual Basic Professional and Enterprise editions include the Windows Common controls that allow you to create applications with the look and feel of Windows 95 toolbars, status bars, and tree views of directory structures. Other controls allow you to create applications that take full advantage of the Internet. Visual Basic has always featured a variety of controls that you could use in your applications. Now you can create your own controls, for use with Visual Basic and other development tools. With ActiveX controls, your investment in Visual Basic carries forward to the Internet. Designing an ActiveX control can be as easy as designing a Visual Basic form you can use familiar Visual Basic graphics commands to paint your control, or create a control group using existing controls. ActiveX controls can be debugged in process, so you can step directly from the code for your test form into the code for your ActiveX control project. You can add data-binding to your Visual Basic ActiveX control, so that a user can easily bind the individual fields within the control to the appropriate fields in a database or other source of data. You can also use data-binding to create an ActiveX control that other controls can bind to, similar to the Visual Basic Data control. Visual Basic makes it easy to create polished ActiveX control packages by adding property pages, named constants, and events to your controls. You can compile your ActiveX controls directly into your applications executable, or into .ocx files that can be used with development tools

such as Visual Basic and Microsoft Visual C++, with end user products such as Microsoft Office, and on the Internet.

Variables are placeholders used to store values; they have names and data types. The data type of a variable determines how the bits representing those values are stored in the computer's memory. When you declare a variable, you can also supply a data type for it. All

variables have a data type that determines what kind of data they can store. By default, if you don't supply a data type, the variable is given the Variant data type. The Variant data type is like a chameleon it can represent many different data types in different situations. You don't have to convert between these types of data when assigning them to a Variant variable: Visual Basic automatically performs any necessary conversion. If you know that a variable will always store data of a particular type, however, Visual Basic can handle that data more efficiently if you declare a variable of that type. For example, a variable to store a person's name is best represented as a string data type, because a name is always composed of characters. Data types apply to other things besides variables. When you assign a value to a property, that value has a data type; arguments to functions also have data types. In fact, just about anything in Visual Basic that involves data also involves data types.

The fundamental Data Types provided by Visual Basic are listed below:

Data Types
Byte Boolean

Storage Size
1 Byte 2 Bytes 0 to 255 True or False

Range

Integer Long (Long integer) Single (Single-precision floating-point) Double (Double-precision floating-point) Currency Date Object String (Variable Length) String (Fixed Length) Variant (With Numbers) Variant (With Characters) OLE_COLOR

2Bytes 4 Bytes 4 Bytes

-32,768 to 32,767 -2,147,483,648 to 2,147,483,648 -3.402823E38 to -1.401298E-45(for negative values) and 1.401298E-45 to 3.402823E38(for Positive values -1.79769313486232E308 to 4.94065645841247E-324 (for negative values) and 4.94065645841247E-324 to
1.79769313486232E308

8 Bytes

8 Bytes 8 Bytes 4 Bytes 10 Bytes + Length of String Length of String 16 Bytes 22 Bytes + Length of String 4 Bytes

-922,337,203,685,477.5808 to 922,337,203,685,477.5807 January 1, 100 to December 31, 9999 Any Object Reference 0 to approximately 2 Billion

1 to approximately 65,400 Any numeric value up to a Double value Same range as a variable length string

Is treated as a Long variable internally

Converting Data Types Visual Basic provides several conversion functions you can use to convert values into a specific data type. To convert a value to Currency, for example, you use the CCur function:

Conversion function Cbool Cbyte

Converts an expression to Boolean Byte

Ccur Cdate CDbl Cint CLng CSng CStr Cvar CVErr

Currency Date Double Integer Long Single String Variant Error

Values passed to a conversion function must be valid for the destination data type or an error occurs. For example, if you attempt to convert a Long to an Integer, the Long must be within the valid range for the Integer data type.

ACCESSING DATA USING VISUAL BASIC


The figure below is a roadmap of data access technologies found in Visual Basic.

In Visual Basic, three data access interfaces are available to you: ActiveX Data Objects (ADO), Remote Data Objects (RDO), and Data Access Objects (DAO). A data access interface is an object model that represents various facets of accessing data. Using Visual Basic, you can programmatically control the connection, statement builders, and returned data for use in any application. Why there are three data access interfaces in Visual Basic? Data access technology is constantly evolving, and each of the three interfaces represents a different state of the art. The latest is ADO, which features a simpler yet more flexible object model than either RDO or DAO. For new projects, you should use ADO as your data access interface.

DATA BASE

FORMS

CODING

Password Form
Dim X As Integer Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Text2.SetFocus End If End Sub Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Text2.Text = LCase(Text2.Text) If Text2.Text = "confidential" Then MsgBox "Access granted " + Text1.Text, vbInformation, "Message" Unload frmpassword Load frmchoose frmchoose.Show Else MsgBox "Invalid password " + Text1.Text, vbCritical, "Message" Text2.Text = "" X=X+1 End If If X = 3 Then MsgBox "Sorry " + Text1.Text + " three trials only", vbInformation, "Message" End End If End If End Sub

Choose Form
Private Sub Command1_Click() On Error Resume Next Unload frmchoose Load frmbilling frmbilling.Show End Sub Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error Resume Next Command1.BackColor = &HC0FFFF End Sub Private Sub Command2_Click() On Error Resume Next Load frmapplserv frmapplserv.Show 1 End Sub Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error Resume Next Command2.BackColor = &HC0FFFF End Sub Private Sub Command3_Click() On Error Resume Next OLE1.DoVerb 1 End Sub Private Sub Command3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error Resume Next

Command3.ForeColor = &HC0FFFF End Sub Private Sub Command4_Click() On Error Resume Next Load frmmaps frmmaps.Show End Sub Private Sub Command4_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error Resume Next Command4.BackColor = &HC0FFFF End Sub Private Sub Command5_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error Resume Next Command5.BackColor = &HC0FFFF End Sub Private Sub Command6_Click() On Error Resume Next Unload frmchoose Load frmdisconnect frmdisconnect.Show End Sub Private Sub Command6_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error Resume Next Command6.BackColor = &HC0FFFF End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Command1.BackColor = &H8000000F

Command2.BackColor = &H8000000F Command3.ForeColor = vbBlack Command4.BackColor = &H8000000F Command5.BackColor = &H8000000F Command6.BackColor = &H8000000F End Sub Private Sub Label10_Click() On Error Resume Next OLE1.DoVerb 1 End Sub Private Sub Image4_Click(Index As Integer) On Error Resume Next Command3_Click End Sub Private Sub Timer1_Timer() On Error Resume Next Label6.Caption = Time End Sub Private Sub Command5_Click() On Error Resume Next Load frmall frmall.Show 1 End Sub

Billing Form
Option Explicit Dim f Private Sub cmddisabled_Click() On Error Resume Next Text1.Enabled = False Text2.Enabled = False Text3.Enabled = False Text4.Enabled = False Text5.Enabled = False Text6.Enabled = False Text7.Enabled = False Text8.Enabled = False Text9.Enabled = False Text10.Enabled = False Text14.Enabled = False End Sub Private Sub cmdenabled_Click() On Error Resume Next Text2.Enabled = True Text3.Enabled = True Text4.Enabled = True Text5.Enabled = True Text6.Enabled = True Text7.Enabled = True Text9.Enabled = True Text10.Enabled = True Text14.Enabled = True End Sub Private Sub Form_Load() Data1.DatabaseName = App.Path + "\dbbilling.mdb" Data2.DatabaseName = App.Path + "\Counter.mdb"

Toolbar1.Buttons(2).Enabled = False Text1.Enabled = False Text2.Enabled = False Text3.Enabled = False Text4.Enabled = False Text5.Enabled = False Text6.Enabled = False Text7.Enabled = False Text8.Enabled = False Text9.Enabled = False Text10.Enabled = False Text11.Enabled = False Text12.Enabled = False Text13.Enabled = False Text14.Enabled = False txtbill.Enabled = False End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) On Error Resume Next If Text2.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" Cancel = True Else If MsgBox("Close Billing?", vbYesNo + vbQuestion, "Message") = vbNo Then Cancel = True Else Load frmchoose frmchoose.Show Cancel = False End If End If End Sub Private Sub mnuclac_Click()

On Error Resume Next Dim ray ray = Shell("C:\WINDOWS\CALC.EXE", 1) End Sub Private Sub mnuclose_Click() End Sub Private Sub mnudelete_Click() On Error Resume Next If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" ElseIf Text1.Text = "" Then MsgBox "There are no record to delete", vbInformation, "Message" Else If Text1.Text = "01" Or Text1.Text = "02" Or Text1.Text = "03" Or Text1.Text = "04" Or Text1.Text = "05" Or Text1.Text = "06" Or Text1.Text = "07" Or Text1.Text = "08" Or Text1.Text = "09" Or Text1.Text = "10" Then MsgBox "Bill ID number is being used by this system view map for information", vbCritical, "Message" Else If MsgBox("Delete this record?", vbYesNo + vbQuestion, "Message") = vbYes Then Data1.Recordset.Delete Data1.Recordset.MoveNext Load frmdelete frmdelete.Show 1 End If End If End If End Sub Private Sub mnuedit_Click()

On Error Resume Next If txtstatus.Text = "Disconnected" Then MsgBox "Cannot edit Bill ID number status disconnected", vbCritical, "Message" Else Data1.Recordset.Edit mnunew.Enabled = False mnuedit.Enabled = False mnusave.Enabled = True Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(2).Enabled = True cmdenabled_Click Text2.SetFocus End If End Sub Private Sub mnufind_Click() On Error Resume Next If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" Else Dim f f = InputBox("Input Bill ID No. or Family name", "Find") If f <> "" Then Data1.RecordSource = ("select * from tblebill where ServiceIDNo = '" & f + "' or FamilyName= '" & f + "'") Data1.Refresh End If If Text1.Text = "" Then MsgBox "Record does not exist", vbInformation, "Message" Data1.RecordSource = "select * from tblebill where ServiceIDNo <> '""'" Data1.Refresh End If End If End Sub

Private Sub mnunew_Click() On Error Resume Next Dim n n = InputBox("Please supply password or type 'cancel' to undo", "Message") n = LCase(n) If n = "confidential" Then Data1.Recordset.AddNew mnunew.Enabled = False mnuedit.Enabled = False mnusave.Enabled = True Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(2).Enabled = True txtstudnoctr.Text = Val(txtstudnoctr.Text) + 1 Text1.Text = Format$(txtstudnoctr.Text, "00") cmdenabled_Click txtstatus.Text = "Connected" Text2.SetFocus ElseIf n = "cancel" Then MsgBox "Adding new service ID number cancel", vbInformation, "Message" ElseIf n = "" Then 'do nothing Else MsgBox "Invalid password", vbCritical, "Message" mnunew_Click End If End Sub Private Sub mnupreview_Click() On Error Resume Next If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" Else

DataEnvironment1.Commands(1).CommandText = "Select * from tblebill where ServiceIDNo = '" & Text1.Text & "' " DataEnvironment1.Commands(1).Execute Load DataReport1 DataReport1.Show 1 DataEnvironment1.rsCommand1.Close End If End Sub Private Sub mnuprint_Click() On Error Resume Next If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" Else DataEnvironment1.Commands(1).CommandText = "Select * from tblebill where ServiceIDNo = '" & Text1.Text & "' " DataEnvironment1.Commands(1).Execute DataReport1.PrintReport CommonDialog1.Copies DataEnvironment1.rsCommand1.Close End If End Sub Private Sub mnusave_Click() On Error Resume Next Data1.Recordset.Update Text11.Text = Val(Text6.Text) * 3.4 Text12.Text = Val(Text11.Text) * 0.0629 Text13.Text = Val(Text6.Text) * 2.463 txtbill.Text = Val(Text11.Text) + Val(Text12.Text) + Val(Text13.Text) txtbill.Text = Format(txtbill.Text, ".00") mnunew.Enabled = True mnuedit.Enabled = True

mnusave.Enabled = False Toolbar1.Buttons(5).Enabled = True Toolbar1.Buttons(4).Enabled = True Toolbar1.Buttons(2).Enabled = False cmddisabled_Click End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text2.SetFocus End If End Sub Private Sub Text10_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text14.SetFocus End If End Sub Private Sub Text14_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text6.SetFocus End If End Sub Private Sub Text2_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text3.SetFocus End If End Sub Private Sub Text3_KeyPress(KeyAscii As Integer)

On Error Resume Next If KeyAscii = 13 Then Text4.SetFocus End If End Sub Private Sub Text4_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text5.SetFocus End If End Sub Private Sub Text5_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text10.SetFocus End If End Sub Private Sub Text6_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text7.SetFocus End If End Sub Private Sub Text7_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text9.SetFocus Text8.Text = Text14.Text End If End Sub

Private Sub Text8_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text9.SetFocus End If End Sub Private Sub Text9_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text11.Text = Val(Text6.Text) * 3.4 Text12.Text = Val(Text11.Text) * 0.0629 Text13.Text = Val(Text6.Text) * 2.463 txtbill.Text = Val(Text11.Text) + Val(Text12.Text) + Val(Text13.Text) txtbill.Text = Format(txtbill.Text, ".00") End If End Sub Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) On Error Resume Next Select Case Button.Key Case "tnew" mnunew_Click Case "tedit" mnuedit_Click Case "tsave" mnusave_Click Case "tdelete" mnudelete_Click

Case "tfirst" If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" Else Data1.Recordset.MoveFirst MsgBox "First record", vbInformation, "Message" End If Case "tprevious" If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" Else Data1.Recordset.MovePrevious If Data1.Recordset.BOF = True Then MsgBox "First record already", vbInformation, "Message" End If End If Case "tnext" If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" Else Data1.Recordset.MoveNext If Data1.Recordset.EOF = True Then MsgBox "Last record already", vbInformation, "Message" End If End If Case "tlast" If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" Else Data1.Recordset.MoveLast MsgBox "Last record", vbInformation, "Message" End If

Case "tfind" mnufind_Click Case "tpreview" mnupreview_Click Case "tprint" mnuprint_Click End Select End Sub

Service Application
Private Sub cmddisabled_Click() On Error Resume Next txtdate.Enabled = False Text1.Enabled = False Text2.Enabled = False Text3.Enabled = False Text4.Enabled = False Text5.Enabled = False Text6.Enabled = False Text7.Enabled = False Text8.Enabled = False Text9.Enabled = False Text10.Enabled = False Text11.Enabled = False Text12.Enabled = False Text13.Enabled = False Text14.Enabled = False Text15.Enabled = False Text16.Enabled = False Text17.Enabled = False Text18.Enabled = False Text19.Enabled = False Text20.Enabled = False Text21.Enabled = False Text22.Enabled = False Text23.Enabled = False Text24.Enabled = False Text25.Enabled = False Text26.Enabled = False Text27.Enabled = False Text28.Enabled = False Text29.Enabled = False Text30.Enabled = False Check1.Enabled = False

Check2.Enabled Check3.Enabled Check4.Enabled Check5.Enabled Check6.Enabled Check7.Enabled

= = = = = =

False False False False False False False False False False False

Combo1.Enabled Combo2.Enabled Combo3.Enabled Combo4.Enabled Combo5.Enabled End Sub

= = = = =

Private Sub cmdenabled_Click() On Error Resume Next txtdate.Enabled = True Text1.Enabled = True Text2.Enabled = True Text3.Enabled = True Text4.Enabled = True Text5.Enabled = True Text6.Enabled = True Text7.Enabled = True Text8.Enabled = True Text9.Enabled = True Text10.Enabled = True Text11.Enabled = True Text12.Enabled = True Text13.Enabled = True Text14.Enabled = True Text15.Enabled = True Text16.Enabled = True Text17.Enabled = True Text18.Enabled = True Text19.Enabled = True Text20.Enabled = True

Text21.Enabled Text22.Enabled Text23.Enabled Text24.Enabled Text25.Enabled Text26.Enabled Text27.Enabled Text28.Enabled Text29.Enabled Text30.Enabled

= = = = = = = = = =

True True True True True True True True True True

Check1.Enabled = True Check2.Enabled = True Check3.Enabled = True Check4.Enabled = True Check5.Enabled = True Check6.Enabled = True Check7.Enabled = True Combo1.Enabled = True Combo2.Enabled = True Combo3.Enabled = True Combo4.Enabled = True Combo5.Enabled = True End Sub Private Sub Combo1_Click() On Error Resume Next Text11.SetFocus End Sub Private Sub Combo2_Click() On Error Resume Next Text12.SetFocus End Sub Private Sub Combo3_Click() On Error Resume Next

txtdate.SetFocus End Sub Private Sub Combo4_Click() On Error Resume Next Text23.SetFocus End Sub Private Sub Combo5_Click() On Error Resume Next Text28.SetFocus End Sub Private Sub Form_Load() txtdate.Enabled = False Text1.Enabled = False Text2.Enabled = False Text3.Enabled = False Text4.Enabled = False Text5.Enabled = False Text6.Enabled = False Text7.Enabled = False Text8.Enabled = False Text9.Enabled = False Text10.Enabled = False Text11.Enabled = False Text12.Enabled = False Text13.Enabled = False Text14.Enabled = False Text15.Enabled = False Text16.Enabled = False Text17.Enabled = False Text18.Enabled = False Text19.Enabled = False Text20.Enabled = False Text21.Enabled = False Text22.Enabled = False

Text23.Enabled Text24.Enabled Text25.Enabled Text26.Enabled Text27.Enabled Text28.Enabled Text29.Enabled Text30.Enabled Check1.Enabled Check2.Enabled Check3.Enabled Check4.Enabled Check5.Enabled Check6.Enabled Check7.Enabled

= = = = = = = = = = = = = = =

False False False False False False False False False False False False False False False False False False False False

Combo1.Enabled Combo2.Enabled Combo3.Enabled Combo4.Enabled Combo5.Enabled

= = = = =

Toolbar1.Buttons(2).Enabled = False Data1.DatabaseName = App.Path + "\dbservice.mdb" Combo1.AddItem "Residential" Combo1.AddItem "Streetlight" Combo1.AddItem "Business" Combo2.AddItem Combo2.AddItem Combo2.AddItem Combo2.AddItem Combo2.AddItem Combo2.AddItem Combo2.AddItem "New Sevice" "Add'l Load" "Streetlight" "Daep/Rep" "Sepn of Serv" "Subdivision" "Temporary"

Combo2.AddItem Combo2.AddItem Combo3.AddItem Combo3.AddItem Combo3.AddItem Combo4.AddItem Combo4.AddItem Combo5.AddItem Combo5.AddItem End Sub

"Relocation/Removal" "Others" "Package 1" "Package 2" "Package 3" "Serv Addr." "Diff Addr." "Serv Addr." "Diff Addr."

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) On Error Resume Next If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" Cancel = True Else If MsgBox("Close service application?", vbYesNo + vbQuestion, "Message") = vbNo Then Cancel = True Else Cancel = False End If End If End Sub Private Sub mnudelete_Click() On Error Resume Next If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" ElseIf Text25.Text = "" Then MsgBox "No account name to delete", vbInformation, "Message" Else If MsgBox("Delete this record?", vbYesNo + vbQuestion, "Message") = vbYes Then

Data1.Recordset.Delete Data1.Recordset.MoveNext Load frmdelete frmdelete.Show 1 End If End If End Sub Private Sub mnuedit_Click() On Error Resume Next Data1.Recordset.Edit mnunew.Enabled = False mnuedit.Enabled = False mnusave.Enabled = True Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(2).Enabled = True cmdenabled_Click End Sub Private Sub mnufind_Click() On Error Resume Next f = InputBox("Input account name", "Find") If f <> "" Then Data1.RecordSource = ("select * from tbleservice where name = '" & f + "'") Data1.Refresh ElseIf f = "" Then 'do nothing End If If Text25.Text = "" Then MsgBox "Account name do not exist", vbInformation, "Message" Data1.RecordSource = "select * from tbleservice where name <> '""'" Data1.Refresh

End If End Sub Private Sub mnunew_Click() On Error Resume Next Data1.Recordset.AddNew mnunew.Enabled = False mnuedit.Enabled = False mnusave.Enabled = True Toolbar1.Buttons(4).Enabled = False Toolbar1.Buttons(5).Enabled = False Toolbar1.Buttons(2).Enabled = True cmdenabled_Click Text1.SetFocus End Sub Private Sub mnusave_Click() On Error Resume Next If Text25.Text = "" Then MsgBox "Please input account name", vbInformation, "Message" Text25.SetFocus ElseIf txtdate.Text = "" Then MsgBox "Please input target date", vbInformation, "Message" txtdate.SetFocus Else lblapplied = Text31.Text Data1.Recordset.Update mnunew.Enabled = True mnuedit.Enabled = True mnusave.Enabled = False Toolbar1.Buttons(5).Enabled = True Toolbar1.Buttons(4).Enabled = True Toolbar1.Buttons(2).Enabled = False cmddisabled_Click End If End Sub

Private Sub mnustandard_Click() On Error Resume Next If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" Else Load frmstandardload frmstandardload.Show 1 End If End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text2.SetFocus End If End Sub Private Sub Text10_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text11.SetFocus End If End Sub Private Sub Text11_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text12.SetFocus End If End Sub Private Sub Text12_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text13.SetFocus End If

End Sub Private Sub Text13_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text14.SetFocus End If End Sub Private Sub Text14_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text15.SetFocus End If End Sub Private Sub Text15_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text16.SetFocus End If End Sub Private Sub Text16_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text17.SetFocus End If End Sub Private Sub Text17_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text18.SetFocus End If End Sub

Private Sub Text18_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then txtdate.SetFocus End If End Sub Private Sub Text19_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text20.SetFocus End If End Sub Private Sub Text2_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text3.SetFocus End If End Sub Private Sub Text20_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text21.SetFocus End If End Sub Private Sub Text21_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text22.SetFocus End If End Sub Private Sub Text22_KeyPress(KeyAscii As Integer) On Error Resume Next

If KeyAscii = 13 Then Text23.SetFocus End If End Sub Private Sub Text23_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text24.SetFocus End If End Sub Private Sub Text24_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text25.SetFocus End If End Sub Private Sub Text25_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text26.SetFocus End If End Sub Private Sub Text26_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text27.SetFocus End If End Sub Private Sub Text27_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text28.SetFocus

End If End Sub Private Sub Text28_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text29.SetFocus End If End Sub Private Sub Text29_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text30.SetFocus End If End Sub Private Sub Text3_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text4.SetFocus End If End Sub Private Sub Text4_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text5.SetFocus End If End Sub Private Sub Text5_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text6.SetFocus End If End Sub

Private Sub Text6_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text7.SetFocus End If End Sub Private Sub Text7_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text8.SetFocus End If End Sub Private Sub Text8_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text9.SetFocus End If End Sub Private Sub Text9_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text10.SetFocus End If End Sub Private Sub Timer1_Timer() On Error Resume Next Text31.Text = Date End Sub Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) On Error Resume Next

Select Case Button.Key Case "tnew" mnunew_Click Case "tdelete" mnudelete_Click Case "tsave" mnusave_Click Case "tedit" mnuedit_Click Case "tfirst" If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" Else Data1.Recordset.MoveFirst MsgBox "First record", vbInformation, "Message" End If Case "tprevious" If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" Else Data1.Recordset.MovePrevious If Data1.Recordset.BOF = True Then MsgBox "First record already", vbInformation, "Message" End If End If Case "tnext" If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" Else Data1.Recordset.MoveNext If Data1.Recordset.EOF = True Then MsgBox "Last record already", vbInformation, "Message" End If End If Case "tlast" If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message"

Else Data1.Recordset.MoveLast MsgBox "Last record", vbInformation, "Message" End If Case "tstandard" mnustandard_Click Case "tfind" mnufind_Click End Select End Sub Private Sub txtdate_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Text19.SetFocus End If End Sub

Customer Record
Option Explicit Dim f Private Sub Command1_Click() On Error Resume Next f = InputBox("Input Service ID or Family name", "Find") If f <> "" Then Data1.RecordSource = ("select * from tblebill where ServiceIDNo = '" & f + "' or FamilyName= '" & f + "'") Data1.Refresh End If End Sub Private Sub Command2_Click() On Error Resume Next Data1.RecordSource = ("select * from tblebill order by ServiceIDNo asc") Data1.Refresh End Sub Private Sub Command3_Click() On Error Resume Next Dim a As String a = Data1.Recordset.RecordCount MsgBox ("Total record " + a), vbInformation, "Message" End Sub Private Sub Command4_Click() On Error Resume Next Data1.RecordSource = ("Select * from tblebill where ServiceIDNo <> ' '") Data1.Refresh End Sub Private Sub Command5_Click() On Error Resume Next

Data1.RecordSource = ("select * from tblebill order by ServiceIDNo desc") Data1.Refresh End Sub Private Sub Form_Load() Data1.DatabaseName = App.Path + "\dbbilling.mdb" End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) On Error Resume Next If MsgBox("Exit?", vbYesNo + vbQuestion, "Message") = vbNo Then Cancel = True End If End Sub

Delete Form
Private Sub Form_Load() Animation1.Open App.Path + "\FILEDEL.AVI" Animation1.Play End Sub Private Sub Timer1_Timer() On Error Resume Next Bar1.Value = Bar1.Value + 5 Label1.Caption = Bar1.Value If Bar1.Value = 150 Then Unload frmdelete End If End Sub

Dis/Connection
Private Sub Command1_Click() On Error Resume Next If MsgBox("Disconnect " + Text1.Text + " Bill ID no.", vbYesNo + vbQuestion, "Message") = vbYes Then Data1.Recordset.Edit lblstatus.Caption = "Disconnected" Data1.Recordset.Update MsgBox "Service ID " + Text1.Text + " disconnected", vbInformation, "Message" End If End Sub Private Sub Command2_Click() On Error Resume Next If MsgBox("Connect " + Text1.Text + " Bill ID no.", vbYesNo + vbQuestion, "Message") = vbYes Then Data1.Recordset.Edit lblstatus.Caption = "Connected" Data1.Recordset.Update MsgBox "Service ID " + Text1.Text + " connected", vbInformation, "Message" End If End Sub Private Sub Command3_Click() On Error Resume Next f = InputBox("Input Bill ID No. or Family name", "Find") If f <> "" Then Data1.RecordSource = ("select * from tblebill where ServiceIDNo = '" & f + "' or FamilyName= '" & f + "'") Data1.Refresh End If If Text1.Text = "" Then MsgBox "Record does not exist", vbInformation, "Message"

Data1.RecordSource = "select * from tblebill where ServiceIDNo <> '""'" Data1.Refresh End If End Sub Private Sub Command4_Click() On Error Resume Next If lblstatus.Caption = "Connected" Then MsgBox "Cannot print Bill ID number status connected", vbCritical, "Message" Else DataEnvironment1.Commands(1).CommandText = "Select * from tblebill where ServiceIDNo = '" & Text1.Text & "' DataEnvironment1.Commands(1).Execute Load DataReport2 DataReport2.Show 1 DataEnvironment1.rsCommand1.Close End If End Sub Private Sub Command5_Click() On Error Resume Next Data1.RecordSource = "select * from tblebill where ServiceIDNo <> '""'" Data1.Refresh End Sub

Private Sub Command6_Click() On Error Resume Next f = InputBox("Input Date", "Find") If f <> "" Then Data1.RecordSource = ("select * from tblebill where DueDate = '" & f + "'")

Data1.Refresh End If If Text1.Text = "" Then MsgBox "Due date do not exist", vbInformation, "Message" Data1.RecordSource = "select * from tblebill where ServiceIDNo <> '""'" Data1.Refresh End If End Sub Private Sub Form_Load() Data1.DatabaseName = App.Path + "\dbbilling.mdb" End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) On Error Resume Next If Text1.Enabled = True Then MsgBox "Save record first", vbInformation, "Message" Cancel = True Else If MsgBox("Exit?", vbYesNo + vbQuestion, "Message") = vbNo Then Cancel = True Else Load frmchoose frmchoose.Show Cancel = False End If End If End Sub Private Sub Timer1_Timer() On Error Resume Next If Timer1.Interval = 1000 Then lblstatus.FontItalic = True Timer1.Enabled = False

Timer2.Enabled = True End If End Sub Private Sub Timer2_Timer() On Error Resume Next If Timer1.Interval = 1000 Then lblstatus.FontItalic = False Timer2.Enabled = False Timer1.Enabled = True End If End Sub

Map
Option Explicit Dim a Dim X As Integer Private Sub cmdblack_Click() On Error Resume Next a=0 txtinput.Visible = False Text1.ForeColor = vbWhite Text2.ForeColor = vbWhite Text3.ForeColor = vbWhite Text4.ForeColor = vbWhite Text5.ForeColor = vbWhite End Sub Private Sub cmdwhite_Click() On Error Resume Next txtinput.Visible = True txtinput.Text = "" txtinput.SetFocus Text1.ForeColor = vbBlack Text2.ForeColor = vbBlack Text3.ForeColor = vbBlack Text4.ForeColor = vbBlack Text5.ForeColor = vbBlack End Sub Private Sub Form_Activate() txtinput.SetFocus End Sub Private Sub Form_Load() Data1.DatabaseName = App.Path + "\dbbilling.mdb" X=0 a=0 End Sub

Private Sub Timer1_Timer() On Error Resume Next If fra1.Width < 2145 Then fra1.Width = fra1.Width + 100 End If If fra1.Height < 1965 Then fra1.Height = fra1.Height + 100 End If If fra1.Height >= 1965 Then X=X+1 End If If X = 50 Then Timer1.Enabled = False tmr1.Enabled = True X=0 End If End Sub Private Sub Timer10_Timer() On Error Resume Next If fra10.Width < 2145 Then fra10.Width = fra10.Width + 100 End If If fra10.Height < 1965 Then fra10.Height = fra10.Height + 100 End If If fra10.Height >= 1965 Then X=X+1 End If If X = 50 Then Timer10.Enabled = False tmr10.Enabled = True X=0 End If End Sub

Private Sub Timer2_Timer() On Error Resume Next If fra2.Width < 2145 Then fra2.Width = fra2.Width + 100 End If If fra2.Height < 1965 Then fra2.Height = fra2.Height + 100 End If If fra2.Height >= 1965 Then X=X+1 End If If X = 50 Then Timer2.Enabled = False tmr2.Enabled = True X=0 End If End Sub Private Sub Timer3_Timer() On Error Resume Next If fra3.Width < 2145 Then fra3.Width = fra3.Width + 100 End If If fra3.Height < 1965 Then fra3.Height = fra3.Height + 100 End If If fra3.Height >= 1965 Then X=X+1 End If If X = 50 Then Timer3.Enabled = False tmr3.Enabled = True X=0 End If End Sub

Private Sub Timer4_Timer() On Error Resume Next If fra4.Width < 2145 Then fra4.Width = fra4.Width + 100 End If If fra4.Height < 1965 Then fra4.Height = fra4.Height + 100 End If If fra4.Height >= 1965 Then X=X+1 End If If X = 50 Then Timer4.Enabled = False tmr4.Enabled = True X=0 End If End Sub Private Sub Timer5_Timer() On Error Resume Next If fra5.Width < 2145 Then fra5.Width = fra5.Width + 100 End If If fra5.Height < 1965 Then fra5.Height = fra5.Height + 100 End If If fra5.Height >= 1965 Then X=X+1 End If If X = 50 Then Timer5.Enabled = False tmr5.Enabled = True X=0 End If End Sub

Private Sub Timer6_Timer() On Error Resume Next If fra6.Width < 2145 Then fra6.Width = fra6.Width + 100 End If If fra6.Height < 1965 Then fra6.Height = fra6.Height + 100 End If If fra6.Height >= 1965 Then X=X+1 End If If X = 50 Then Timer6.Enabled = False tmr6.Enabled = True X=0 End If End Sub Private Sub Timer7_Timer() On Error Resume Next If fra7.Width < 2145 Then fra7.Width = fra7.Width + 100 End If If fra7.Height < 1965 Then fra7.Height = fra7.Height + 100 End If If fra7.Height >= 1965 Then X=X+1 End If If X = 50 Then Timer7.Enabled = False tmr7.Enabled = True X=0 End If End Sub Private Sub Timer8_Timer() On Error Resume Next

If fra8.Width < 2145 Then fra8.Width = fra8.Width + 100 End If If fra8.Height < 1965 Then fra8.Height = fra8.Height + 100 End If If fra8.Height >= 1965 Then X=X+1 End If If X = 50 Then Timer8.Enabled = False tmr8.Enabled = True X=0 End If End Sub Private Sub Timer9_Timer() On Error Resume Next If fra9.Width < 2145 Then fra9.Width = fra9.Width + 100 End If If fra9.Height < 1965 Then fra9.Height = fra9.Height + 100 End If If fra9.Height >= 1965 Then X=X+1 End If If X = 50 Then Timer9.Enabled = False tmr9.Enabled = True X=0 End If End Sub Private Sub tmr1_Timer() On Error Resume Next If fra1.Width > 0 Then

fra1.Width = fra1.Width - 100 End If If fra1.Height > 0 Then fra1.Height = fra1.Height - 100 X=X+1 End If If X = 50 Then cmdwhite_Click tmr1.Enabled = False X=0 End If End Sub Private Sub tmr10_Timer() On Error Resume Next If fra10.Width > 0 Then fra10.Width = fra10.Width - 100 End If If fra10.Height > 0 Then fra10.Height = fra10.Height - 100 X=X+1 End If If X = 50 Then cmdwhite_Click tmr10.Enabled = False X=0 End If End Sub Private Sub tmr2_Timer() On Error Resume Next If fra2.Width > 0 Then fra2.Width = fra2.Width - 100 End If If fra2.Height > 0 Then fra2.Height = fra2.Height - 100 X=X+1

End If If X = 50 Then cmdwhite_Click tmr2.Enabled = False X=0 End If End Sub Private Sub tmr3_Timer() On Error Resume Next If fra3.Width > 0 Then fra3.Width = fra3.Width - 100 End If If fra3.Height > 0 Then fra3.Height = fra3.Height - 100 X=X+1 End If If X = 50 Then cmdwhite_Click tmr3.Enabled = False X=0 End If End Sub Private Sub tmr4_Timer() On Error Resume Next If fra4.Width > 0 Then fra4.Width = fra4.Width - 100 End If If fra4.Height > 0 Then fra4.Height = fra4.Height - 100 X=X+1 End If If X = 50 Then cmdwhite_Click tmr4.Enabled = False X=0

End If End Sub Private Sub tmr5_Timer() On Error Resume Next If fra5.Width > 0 Then fra5.Width = fra5.Width - 100 End If If fra5.Height > 0 Then fra5.Height = fra5.Height - 100 X=X+1 End If If X = 50 Then cmdwhite_Click tmr5.Enabled = False X=0 End If End Sub Private Sub tmr6_Timer() On Error Resume Next If fra6.Width > 0 Then fra6.Width = fra6.Width - 100 End If If fra6.Height > 0 Then fra6.Height = fra6.Height - 100 X=X+1 End If If X = 50 Then cmdwhite_Click tmr6.Enabled = False X=0 End If End Sub Private Sub tmr7_Timer() On Error Resume Next

If fra7.Width > 0 Then fra7.Width = fra7.Width - 100 End If If fra7.Height > 0 Then fra7.Height = fra7.Height - 100 X=X+1 End If If X = 50 Then cmdwhite_Click tmr7.Enabled = False X=0 End If End Sub Private Sub tmr8_Timer() On Error Resume Next If fra8.Width > 0 Then fra8.Width = fra8.Width - 100 End If If fra7.Height > 0 Then fra8.Height = fra8.Height - 100 X=X+1 End If If X = 50 Then cmdwhite_Click tmr8.Enabled = False X=0 End If End Sub Private Sub tmr9_Timer() On Error Resume Next If fra9.Width > 0 Then fra9.Width = fra9.Width - 100 End If If fra7.Height > 0 Then fra9.Height = fra9.Height - 100

X=X+1 End If If X = 50 Then cmdwhite_Click tmr9.Enabled = False X=0 End If End Sub Private Sub txtinput_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then Dim f f = txtinput.Text f = LCase(f) If f = "highest" Then a=1 Data1.RecordSource = "select * from tblebill where ServiceIDNo between '" & "01" & "' and '" & "10" & "' order by val(Bill) desc" Data1.Refresh ElseIf f = "lowest" Then a=1 Data1.RecordSource = "select * from tblebill where ServiceIDNo between '" & "01" & "' and '" & "10" & "' order by val(Bill) asc" Data1.Refresh ElseIf f = "exit" Then a=0 Unload frmmaps Else MsgBox "Please input Higest or Lowest to view bill or 'Exit' to cancel", vbCritical, "Message" a=0 txtinput.Text = "" txtinput.SetFocus End If

If a = 1 Then If Text1.Text = "01" Then cmdblack_Click Timer1.Enabled = True ElseIf Text1.Text = "02" Then cmdblack_Click Timer2.Enabled = True ElseIf Text1.Text = "03" Then cmdblack_Click Timer3.Enabled = True ElseIf Text1.Text = "04" Then cmdblack_Click Timer4.Enabled = True ElseIf Text1.Text = "05" Then cmdblack_Click Timer5.Enabled = True ElseIf Text1.Text = "06" Then cmdblack_Click Timer6.Enabled = True ElseIf Text1.Text = "07" Then cmdblack_Click Timer7.Enabled = True ElseIf Text1.Text = "08" Then cmdblack_Click Timer8.Enabled = True ElseIf Text1.Text = "09" Then cmdblack_Click Timer9.Enabled = True ElseIf Text1.Text = "10" Then cmdblack_Click Timer10.Enabled = True End If End If End If End Sub

x-x-x-x-x-x-x-x

DATA ENVIRONMENT

REPORTS

CONCLUSION

CONCLUSION
Computer based system is capable of processing large amount of data at a high speed. Most data can be stored in a small space for years together without any trouble and can be retrieved as when required in a few seconds. So, computer based system is necessary for large processing.

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