1 All Powder Board and Ski Microsoft Access Workbook Chapter 6: Forms and Reports Jerry Post...
-
Upload
gabrielle-wagner -
Category
Documents
-
view
228 -
download
0
Transcript of 1 All Powder Board and Ski Microsoft Access Workbook Chapter 6: Forms and Reports Jerry Post...
1
All Powder Board and Ski
Microsoft Access WorkbookChapter 6: Forms and ReportsJerry PostCopyright © 2007
2
Form Types
Style Style Description CategoryCustomer
Last NameFirst NamePhoneAddressCity
Ski Board Style
Sale
Customer Salesperson
ItemID Description Price Quantity Value
Main
Grid
Main and
Subform
3
Customer Main Form
Combo box
Record navigation
Text boxLabel
4
Action
ActionStart the form wizardSelect the Customer tableTransfer all columns to the right windowUse the Columnar layoutSelect a styleEnter a name for the form
5
Main Form Wizard
Select table Select/transfer fields
6
Form Design View
Toolbox to add controls
Properties to control objects
Right click to open control properties
Right click to open form properties
Switch to design or display view
Field List Box
7
Data Source Properties
Record Source = Customer table
Form properties Control properties
Control Source = CustomerID column
8
Action
ActionSwitch Customer form to design viewAdd a label as a form titleAdd a command buttonSelect Record Operation/Delete RecordAdd a command button to insert recordsRun the form and test the buttonsView/Tab Order and verify sequenceSave the form
9
Adding Command Buttons
10
Initial Grid Form
11
Action
ActionCreate a new form with the wizardTable: SkiBoardStyleColumns: AllSelect the Datasheet layoutTest the form
12
Grid Form Wizard
Datasheet style is simpler than Tabular
Tabular style has more design options
13
Action
ActionSwitch to form Design viewDelete the box for CategoryAdd a combo boxSelect the first lookup optionChoose the ProductCategory tableChoose the Category and CategoryDescription columnsSet column widthsSelect the Category columnStore value into the Category columnRename the combo boxSet the tab orderRun the form and test the combo box
14
Add a Combo Box
Delete the text box
Add a combo box
15
Combo Box Role
SkiBoardStyle
Style Desc Category
Downhill Ski
ProductCategory
BoardBootsClothesElectronicGlassesSki
Display
Select
16
Combo Box Runtime
Click the arrow
Select the item
Chosen value is transferred to form
17
Action
ActionCreate a new form with the wizardSale table, all columnsCustomer table use name, phone, and e-mail columnsEmployee table, use the nameSaleItem table, all columns except SaleIDItemModel table, use Category, ModelID, and ListPriceFinish the wizard and test the form
18
Main/Subform by Sale
19
Initial Sale Form
Need combo box
Fix layout and sizing
Multiply price by quantity Calculate subtotal
20
Action
ActionSwitch to Design viewReplace CustomerID, EmployeeID, and
PaymentMethod with combo boxesUse the Row Source property of the combo
boxes to set a sort orderSet tab order and run the form
21
Initial Sale Form Improvements
22
Most of the Sale Form
Display the subtotal
23
Action
ActionOpen the sub form in Design viewInsert a combo box for the SKUAdd a text box to compute Value=QuantitySold*SalePriceAdd a text box to the footer to compute the subtotal:
=Sum(QuantitySold*SalePrice)Set tab orderTest the sub form calculationsOpen the main form in Design viewAdd subtotal text box and use the expression builder to copy the
subtotal value from the subfrom subtotalTest the form
24
Expression Builder to Copy Subtotal
Open the Sale form
Select the subform
Double click the subtotal control
Formula to copy the subtotal value
25
Final Sale Form
26
Action
ActionCreate a new report with the wizardCustomer table, use all columnsSale table, use all columnsSaleItem table, use all columnsVerify the group breaksClick the Summary Options buttonCompute totals for the QuantityFinish the wizard and switch to design view
27
Customizing Form Properties
Form properties
Text box
28
Action
ActionMake a copy of the Customer form.In Design View, add a header.Drag the Customer title onto the header.Set the background color of the header to yellow.
29
Create the Customer Sales Report
Select all columns from the Customer, Sale, and SaleItem tables
Customer break
Sale break
SaleItem detail
30
Action
ActionCreate a new report with the wizard
31
Report Summary Options
Select this button to calculate subtotals easily
32
Summary Options
33
Initial Report
Customer break
Sale break
SaleItem detail
34
Report Design
Customer break
Sale break
SaleItem detail
Value textbox properties
35
Action
ActionDelete some unnecessary columnsMove items around to improve the lookAdd a text box in the Detail section called Value
to compute [QuantitySold]*[SalePrice]Set currency formatEdit the Sum calculations to be
Sum([QuantitySold]*[SalePrice]Run the form and clean up the layout
36
Final Design
Page break
Correct total
37
Final Report (One Page)
38
Action
ActionCreate a new query to total sales by customerSave the queryCreate a new report based on the queryFor the Customer group, set the Keep Together
property to Whole GroupRun the report
39
Customer Totals Without Items
SELECT Customer.CustomerID, Customer.LastName, Customer.FirstName, Customer.Phone, Customer.EMail, Sale.SaleID, Sale.SaleDate, Sale.ShipCity, Sale.ShipState, Sum([SalePrice]*[QuantitySold]) AS [Value]
FROM (Customer INNER JOIN Sale ON Customer.CustomerID = Sale.CustomerID) INNER JOIN SaleItem ON Sale.SaleID = SaleItem.SaleID
GROUP BY Customer.CustomerID, Customer.LastName, Customer.FirstName, Customer.Phone, Customer.EMail, Sale.SaleID, Sale.SaleDate, Sale.ShipCity, Sale.ShipState
ORDER BY Customer.LastName, Customer.FirstName;
40
Sales Total Design
41
Action
ActionCreate a simple report based on the Customer tableCreate a Sale sub-report from the Sale and SaleItem tables,
grouping it by SaleItem.Create a Rental sub-report from the Rental and RentalItem tablesOpen the Customer report in design viewDrag and drop the two sub-reports onto the Detail section of the
Customer reportUse properties of the sub-reports to set the Link Child and Link
Master Fields to CustomerIDRun the report
42
Subreport: Sales and Rentals
Subreport properties
Link main customer report (master) to subreport (child)
43
Subreport Display
44
Action
ActionCreate a blank form in Design viewSet the properties to remove the scroll bars and
navigation buttonsAdd command buttons to open other forms (Form
Operations/Open Form) and reportsUse colors and graphics to make the form appealingRun the form and test all buttons
45
Creating a Switchboard Form
Start in design view
Add command buttons
Open forms or reports
46
Action
ActionChoose View/Toolbars/CustomizeOn the Toolbars tab create a new toolbarClick the Commands tabDrag the main form icon onto the toolbarAdd a Customers menu option and drag the
customer forms and reports onto itAdd the Help iconTest the toolbar
47
Creating Toolbars and Menus
Create a new toolbar
48
Toolbars and Menus
Drag commands onto the toolbar
49
Action
ActionCreate at least three HTML help files for the All Powder forms using
an HTML editor or WordpadIf necessary, download and install the HTML Help workshopCreate a new project in the workshopAdd the HTML filesEdit the HTML files to add keywordsCreate the mapping file with a text editor and add it to the projectSet project options to build the TOC and index filesCompile and test the help fileEdit the database forms and add the help file name and ContentIDRun the form and press the F1 key to test the help files
50
HTML Help
Form
Help File
AllPowder.chm
HTML Topic
HTML Topic
HTML Topic
HTML Topic
HTML Topic
HTML Topic
Properties:
Help File: AllPowder.chm
Help Context ID: 1
1 Topic A2 Topic B3 Topic C4 Topic D5 Topic E6 Topic F
compile
51
HTML Help Files<Object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e"> <PARAM name="Keyword" value="Contents"> <PARAM name="Keyword" value="Introduction"> <PARAM name="Keyword" value="Start"> <PARAM name="Keyword" value="Management"></OBJECT><HTML><HEAD><TITLE>All Powder Board and Ski Shop</TITLE><LINK rel="stylesheet" type="text/css" href="Styles.css"></HEAD><BODY><H1>Introduction to the All Powder Board and Ski Shop</H1><TABLE><TR><TD><IMG SRC='BoardLogo1.gif' border='0'></TD><TD>All Powder Board and Ski Shop sells and rents snowboards and skis for all levels of riders and skiers.</TD></TR></TABLE><H2>The Board and Ski Shop</H2><UL><LI><A HREF=’Customers.html'>Customers</A></LI><LI><A HREF=’Sales.html'>Sales </A></LI></UL></BODY></HTML>
52
Topics Map File
#define AllPowder 100
#define Customers 10000
#define Sales 20000
53
Help Compiler and File
54
Help File on Access Form
File name
Topic number