[ Pobierz całość w formacie PDF ]
.In thischapter, you learn how to build an application framework andUsing the Modulehow to extend the power of an application using Visual Basic.windowUsing the CommandButton Wizard toInstant Applications Using thecreate Visual BasiccodeAccess 2002 Database WizardConverting macros toIt s 3 p.m.on a Friday.A potential new client has just calledVisual Basicand said he hears that you do great work.The client wants acustom system to do whatever and wants to see a proto-&' &' &' &'type of what you can do by Monday morning at 10 a.m.Doyou cancel the weekend picnic with the family? Do youreschedule your golf or tennis match and order plenty of JoltCola? No.There s a great way to get started: create a proto-type using the Access 2002 Database Wizard!An application prototype presents a preview of how the com-pleted application may function.A prototype consists of thebasic framework of the application: the main switchboard,some tables and queries, and a scaled-down version of theapplication s most significant forms and reports.The proto-type provides a visual tool for planning and designing the fin-ished application.The Database Wizard provides a quick andeasy way to get your application prototype up and running.The Database Wizard is similar to Table Wizards.TableWizards in Access 2002 enable you to choose business and3596-X ch30.F 5/30/01 11:46 AM Page 962Part V &' Access Application Tools962personal table definitions expenses, contact management, order entry, time andbilling, and so on from a list.Some definitions contain multiple tables, such asOrders and Items.After you select your table(s), Access displays a set of fields andenables you to choose which ones to include.The program then builds the table foryou.Optionally, you can also have a simple AutoForm created.Although this fea-ture is a real time-saver, it pales in comparison with the Database Wizard.Cross- For a review of using the Table Wizard, see Chapter 5.ReferenceThe Access 2002 Database Wizard takes the concept of Table Wizards to a new dimen-sion by combining the best features of Access Wizards with the amazing power of anapplication generator.Application generators have been popular for many years insome products.These tools eliminate the tedious process of building the basic ele-ments of an application from scratch over and over again for each new applicationyou create.They enable you to quickly generate the basic building blocks of yourapplication and establish a consistent look and feel from one application to another.The Access 2002 Database Wizard doesn t require you to define a table design first;it doesn t make you create a form or report; it simply builds a complete, customiz-able application, including tables, forms, modules, reports, and a user-modifiableswitchboard (the application s main menu).The Wizard doesn t build just one tableor form.The Database Wizard builds groups of tables; adds the table relationships;builds forms for each table, including one-to-many forms, where appropriate; andeven adds critical reports for the type of application you are building.This processmeans that the Wizard creates an entire ready-to-run application.As you go throughthe Wizard process, you determine which fields from each table definition are used;some fields are mandatory, and some are optional.You can always make changesafter the application is built.The order-entry application you build in this chapter creates 10 tables, 14 forms,and 8 reports, including customer reports, sales reports, and even an aged-receivables statement everything you need to start a basic order-entry system.Getting startedYou start the Database Wizard by choosing New From Template ª' GeneralTemplates in the task pane.Access 2002 displays the New dialog box.Select theDatabases tab, as shown in Figure 30-1.Each icon represents a different applicationthe Database Wizard can create.When you create an application, that application iscreated in its own database container.The Database Wizard enables you to choose among a wide variety of applications,as follows:&' Asset Tracking&' Order Entry&' Contact Management3596-X ch30.F 5/30/01 11:46 AM Page 963Chapter 30 &' Working with Visual Basic in Access 2002963&' Resource Scheduling&' Event Management&' Service Call Management&' Expenses&' Time and Billing&' Inventory Control&' LedgerFigure 30-1: Starting the Database WizardWhen you decide which application is closest to the one you want to create, double-click it to start defining your own application.For the example in this chapter,choose the Order Entry application.When you choose the Order Entry application, the File New Database dialog boxappears.Use this dialog box to enter a name for the database.This dialog box is astandard File navigation-type dialog box that enables you to select the drive, direc-tory, and database name.The default name is the name of the application.In thisexample, the name is Order Entry1.mdb.You can make the name anything youwant, and you can change it later by renaming the database with the WindowsExplorer.Press the Create button to create the new database.3596-X ch30.F 5/30/01 11:46 AM Page 964Part V &' Access Application Tools964When the Wizard starts, the dialog box shown in Figure 30-2 appears, showing a pic-torial representation of the system.In this example, the dialog box tells you that sixbasic functions will be created: Customer information, Order information, OrderDetails, Payment information, Product information, and My Company Information.These functions generally are tables or forms.After you view this introductory dia-log box, you can click the standard Next> button to go to the next dialog box.Figure 30-2: Learning what the database willcreate for youWorking with tables and fieldsThe next Wizard screen (see Figure 30-3) enables you to work with the tables andfields of the database.Most of the fields and tables are mandatory, but you also canselect optional fields for each table.The tables are listed on the left side of the dia-log box, and the fields that make up the table are on the right side of the dialog box.Figure 30-3: Working with tables and fields3596-X ch30.F 5/30/01 11:46 AM Page 965Chapter 30 &' Working with Visual Basic in Access 2002965As you select each table, the list of fields changes.Fields that are optional appearitalicized.When you check the fields, the Wizard includes them in the table design.Selecting AutoFormat stylesAfter you make your selections, you can move to the next Wizard screen, whichenables you to select the style for your forms.You can choose any of theAutoFormat options shown in Figure 30-4.If you created your own AutoFormats,they are listed here, too.Figure 30-4: Selecting an AutoFormat for the screensAfter you select the style of your forms, you can do the same for reports
[ Pobierz całość w formacie PDF ]