refresher assignment
TRANSCRIPT
-
8/8/2019 Refresher Assignment
1/33
Refresher AssignmentRefresher Assignment
Microsoft AccessMicrosoft Access
-
8/8/2019 Refresher Assignment
2/33
Open FileOpen File XYZ CoXYZ Co
Employee List tableEmployee List table Design viewDesign view
GenderGender field properties:field properties: Input MaskInput Mask >L>L
Insert fieldInsert field StateIDStateID before Start Date:before Start Date:
TextText
Size = 2Size = 2
-
8/8/2019 Refresher Assignment
3/33
Lookup Fields to another tableLookup Fields to another table Employee List table:Employee List table:
1.1. Rename Department to DeptIDRename Department to DeptID
2.2. Change data type Text toChange data type Text to Lookup WizardLookup Wizard
3.3. Select theSelect the 11ststoptionoption (lookup another table), Next(lookup another table), Next
4.4. SelectSelect Department ListDepartment List table,table, NextNext5.5. Add both fields (click >>),Add both fields (click >>), NextNext
6.6. Sort bySort by DeptIDDeptID,, NextNext
7.7. UnhideUnhide Key Column (2 cols should appear, adjust columnKey Column (2 cols should appear, adjust column
width),width), NextNext8.8. NextNext,, FinishFinish, Save (, Save (YesYes))
9.9. Data type is still Text, but Lookupproperties hv been set.Data type is still Text, but Lookupproperties hv been set.
10.10. DescriptionDescription --((lookup created to Department List tablelookup created to Department List table))
-
8/8/2019 Refresher Assignment
4/33
ScenarioScenario
Open Employee list table in Datasheet view.Open Employee list table in Datasheet view.
Go to any of the DeptID column and type XXXGo to any of the DeptID column and type XXXand press ENTERand press ENTER
Is it accepted ?Is it accepted ?
How to rectify?How to rectify?
Undo changes before proceedingUndo changes before proceeding
-
8/8/2019 Refresher Assignment
5/33
Limit to Lookup ListLimit to Lookup List
Switch to Design view.Switch to Design view.
Place cursor in DeptID field.Place cursor in DeptID field. Field Properties:Field Properties:
go to Lookupgo to Lookup
Limit to ListLimit to ListYesYes
Save table.Save table.
Switch to datasheet view n test againSwitch to datasheet view n test again
-
8/8/2019 Refresher Assignment
6/33
Lookup StateID (Employee List) toLookup StateID (Employee List) toStateID (State List)StateID (State List)
Employee List table:Employee List table:1.1. Change StateID data type toChange StateID data type to Lookup WizardLookup Wizard
2.2. Select theSelect the 11ststoptionoption (lookup another table), Next(lookup another table), Next
3.3. SelectSelect State ListState List table,table, NextNext
4.4. Add both fields (click >>),Add both fields (click >>), NextNext
5.5. Sort bySort by StateIDStateID,, NextNext
6.6. UnhideUnhide Key Column (2 cols should appear, adjust columnKey Column (2 cols should appear, adjust columnwidth),width), Next, NextNext, Next,, FinishFinish, Save (, Save (YesYes))
7.7. Data type is still Text, but Lookupproperties hv been set.Data type is still Text, but Lookupproperties hv been set.8.8. DescriptionDescription --((lookup created to State List tablelookup created to State List table))
9.9. Set Limit to ListpropertiesSet Limit to Listproperties
10.10. List RowsList Rows set to 14set to 14
-
8/8/2019 Refresher Assignment
7/33
RelationshipRelationship
Tools menuTools menu RelationshipsRelationships
Relationship lines hv been created during theRelationship lines hv been created during theLookupprocess.Lookupprocess.
To enforce relationships:To enforce relationships:
DoubleDouble--click on the relationship lineclick on the relationship line
EnforceEnforce
OKOK
-
8/8/2019 Refresher Assignment
8/33
QueryQuery
Create new query in Design view.Create new query in Design view.
Add all 3 tables.Add all 3 tables. Insert the following fields:Insert the following fields:
Save the query asSave the query as Related DetailsRelated Details
Employee ListEmployee List Department ListDepartment List State ListState List
All fields exceptAll fields except
DeptID and StateIDDeptID and StateID
DepartmentDepartment StateState
-
8/8/2019 Refresher Assignment
9/33
QueryQuery Formula 1Formula 1
Make a copyMake a copy of the Related Details query.of the Related Details query.
Rename toRename to Formula 1Formula 1..
Insert a column next to EmpID.Insert a column next to EmpID. Create a formula to combine FirstName andCreate a formula to combine FirstName and
LastName:LastName:
Delete FirstName and LastName columns.Delete FirstName and LastName columns.
FullName: [first name] & " " & [last name]
-
8/8/2019 Refresher Assignment
10/33
QueryQuery Formula 1 (cont.)Formula 1 (cont.)
Insert a column next to Salary.Insert a column next to Salary.
Create a formula to calculate EPF which is 9%Create a formula to calculate EPF which is 9%of Salaryof Salary
Set EPF to Standard number format withoutSet EPF to Standard number format without
decimal places.decimal places.
EPF: [salary]*0.09
-
8/8/2019 Refresher Assignment
11/33
QueryQuery Formula 1 (cont..)Formula 1 (cont..)
Insert a column next to Start Date.Insert a column next to Start Date.
Create a formula to calculate Years Worked.Create a formula to calculate Years Worked.
YrsWorked: Year(Now())-Year([start date])
YrsWorked: (Now()-[start date])/365.25
-
8/8/2019 Refresher Assignment
12/33
QueryQuery -- FilterFilter
Make another copy of Formula 1 query.Make another copy of Formula 1 query.
Rename toRename to FilterFilter..
Criteria:Criteria:1.1. Fullname beginning with MFullname beginning with M
2.2. Fullname containing ALEXFullname containing ALEX
3.3. Position containing MGRPosition containing MGR
4.4. DivisionDivision all except Printerall except Printer
5.5. Fullname beginning with M or AFullname beginning with M or A
6.6. Fullname beginning with M or A or EFullname beginning with M or A or E
-
8/8/2019 Refresher Assignment
13/33
Moving OnMoving On
-
8/8/2019 Refresher Assignment
14/33
QueryQuery Filter (cont.)Filter (cont.)
Criteria:Criteria:
Fullname beginning with M or A or EFullname beginning with M or A or EANDANDfrom Sales and Marketing Department (SAM)from Sales and Marketing Department (SAM)
Whats the best way to do this?Whats the best way to do this?
-
8/8/2019 Refresher Assignment
15/33
QueryQuery Filter (cont..)Filter (cont..)
CriteriaCriteria::
1.1. Position containing MGRPosition containing MGRandandSalary more than 11,000Salary more than 11,000
CriteriaCriteria::
1.1. Employees aged between 30 and 40Employees aged between 30 and 40
2.2. Females aged =40
-
8/8/2019 Refresher Assignment
16/33
QueryQuery Filter (cont)Filter (cont)
Start Date:Start Date:
from the year 2000 onwardsfrom the year 2000 onwards between year 1995 and 1998between year 1995 and 1998
anywhere in the month Novanywhere in the month Nov
-
8/8/2019 Refresher Assignment
17/33
QueryQuery TotalsTotals
-
8/8/2019 Refresher Assignment
18/33
QueryQuery TotalsTotals Make a copy of the Formula 1 query and rename toMake a copy of the Formula 1 query and rename to
Salary Totals by DeparmentSalary Totals by Deparment
Remove all fields exceptRemove all fields except DepartmentDepartment,, SalarySalary && EPFEPF
Click Totals icon:Click Totals icon: DepartmentDepartment Group byGroup by
SalarySalary SumSum
EPFEPF SumSum
Add another Salary field and choose AvgAdd another Salary field and choose Avg
Add another Salary field and choose CountAdd another Salary field and choose Count Set Formatproperties accordinglySet Formatproperties accordingly
-
8/8/2019 Refresher Assignment
19/33
Crosstab QueryCrosstab Query
Total Salary by
Department and
Gender
EmployeeCount by
Department and
Gender
-
8/8/2019 Refresher Assignment
20/33
QueryQuery CrosstabCrosstab Make a copy for the Formula 1 query andMake a copy for the Formula 1 query and
rename torename to Employee Crosstab byEmployee Crosstab byDepartmentDepartment
Remove all fields exceptRemove all fields except DepartmentDepartment,,GenderGender andand SalarySalary..
Query menuQuery menu Crosstab QueryCrosstab Query
-
8/8/2019 Refresher Assignment
21/33
QueryQuery Crosstab 2Crosstab 2
Create a crosstab query to calculate totalCreate a crosstab query to calculate totalsalary by Department and Divisionsalary by Department and Division
-
8/8/2019 Refresher Assignment
22/33
Parameter QueryParameter Query
A parameter query is a query that, when run,A parameter query is a query that, when run,displays its own dialog box prompting you fordisplays its own dialog box prompting you for
information.information.
Useful to generate report for various range ofUseful to generate report for various range ofdates.dates.
User can create a standard report format butUser can create a standard report format butgenerate data for different criterias.generate data for different criterias.
-
8/8/2019 Refresher Assignment
23/33
Parameter QueryParameter Query -- DeptIDDeptID
This query will prompt for DeptID each time you runThis query will prompt for DeptID each time you runthe query.the query.
Make a copy of the Formula 1 query and rename toMake a copy of the Formula 1 query and rename toParameterParameter -- Dept?Dept?
InsertInsert DeptIDDeptID from Employee List after Positionfrom Employee List after Positioncolumn.column. CriteriaCriteria
Save the query.Save the query. Switch to datasheet view and a prompt will appear.Switch to datasheet view and a prompt will appear. Type any DeptID such as ADM or SAM or ENG andType any DeptID such as ADM or SAM or ENG andpress ENTERpress ENTER
[Enter DeptID][Enter DeptID]
-
8/8/2019 Refresher Assignment
24/33
Parameter QueryParameter Query Date RangeDate Range This query will prompt for a starting date and endingThis query will prompt for a starting date and endingdate for a range.date for a range. Make a copy of the Formula 1 query and rename toMake a copy of the Formula 1 query and rename to
ParameterParameter -- Date?Date? CriteriaCriteria
Save the query.Save the query. Switch to datasheet view and a prompt will appear.Switch to datasheet view and a prompt will appear. Type a starting date, press ENTERType a starting date, press ENTER
Another prompt appears for the ending date, enter aAnother prompt appears for the ending date, enter adate and press ENTER.date and press ENTER.
Records that fall between these 2 dates will appear.Records that fall between these 2 dates will appear.
BetweenBetween [Starting Date][Starting Date] andand [Ending Date][Ending Date]
-
8/8/2019 Refresher Assignment
25/33
ReportReport
-
8/8/2019 Refresher Assignment
26/33
Report WizardReport Wizard
Create Reportusing wizard.Create Reportusing wizard.
SelectSelect Table: Employee ListTable: Employee List
DoubleDouble--click required fieldsclick required fields
Group by DeptIDGroup by DeptID
Sort by FirstNameSort by FirstName
Select a layout and styleSelect a layout and style
FinishFinish
-
8/8/2019 Refresher Assignment
27/33
Report DesignReport DesignCreate a Sum for Salary in each Dept.Create a Sum for Salary in each Dept.
Each DeptID has a header, and you are going toEach DeptID has a header, and you are going to
add a Footer:add a Footer: RightRight--clickclick Sorting & GroupingSorting & Grouping Group FooterGroup FooterYesYes
Click the Textbox icon from the Toolbox and clickClick the Textbox icon from the Toolbox and clickin the DeptID footer.in the DeptID footer.
In the Unbound box, typeIn the Unbound box, type =SUM([SALARY])=SUM([SALARY])
Edit the label, format and adjust accordingly.Edit the label, format and adjust accordingly.
-
8/8/2019 Refresher Assignment
28/33
Tabular Report with Totals QueryTabular Report with Totals Query
Create reportusing wizard withCreate reportusing wizard with Query: SalaryQuery: SalaryTotals by DeparmentTotals by Deparment
Add all the fields >> , Next, Next, NextAdd all the fields >> , Next, Next, Next
Select Tabular layout, NextSelect Tabular layout, Next
Choose any style, Next, FinishChoose any style, Next, Finish
Calculate Total below:Calculate Total below: In Design View, increase height of Report Footer.In Design View, increase height of Report Footer.
Use the Textbox icon to create a field.Use the Textbox icon to create a field. Type formulaType formula =Sum([SumOfSalary]) and Enter=Sum([SumOfSalary]) and Enter
Set number format (rightSet number format (right--click, Properties)click, Properties)
Preview the Report.Preview the Report.
-
8/8/2019 Refresher Assignment
29/33
ReportReport Parameter QueryParameter Query Create report wizard using Query: ParameterCreate report wizard using Query: Parameter -- Date?Date?
Insert fieldsInsert fields Next, Next, Next,Next, Next, Next,
Select layout and style, Finish.Select layout and style, Finish.
Fill in prompt,Fill in prompt,eg: start =1/1/90 end=31/12/90eg: start =1/1/90 end=31/12/90
Modify design where necessary & save.Modify design where necessary & save.
You can use the same report to generate output forYou can use the same report to generate output fordifferent range of dates.different range of dates.
-
8/8/2019 Refresher Assignment
30/33
FormsForms
-
8/8/2019 Refresher Assignment
31/33
Simple Form for Data EntrySimple Form for Data Entry
You can create an autoform for any table orYou can create an autoform for any table orqueries:queries:
Select a table or query name.Select a table or query name.
Click AutoForm from the database toolbarClick AutoForm from the database toolbar
Switch to design view to rearrange and formatSwitch to design view to rearrange and format
the fields and labels.the fields and labels.
-
8/8/2019 Refresher Assignment
32/33
Create form using wizard withCreate form using wizard with Table:Table:Employee ListEmployee List
Add all the fields >>, NextAdd all the fields >>, Next
Select Columnar layout, NextSelect Columnar layout, Next
Select any style, Next, FinishSelect any style, Next, Finish
To reTo re--arrange fields, switch to Design view.arrange fields, switch to Design view.
Form WizardForm Wizard
-
8/8/2019 Refresher Assignment
33/33
Form & SubformForm & SubformTo view list of employees by Dept or State:To view list of employees by Dept or State:
Create form wizard usingCreate form wizard using Query:Related DetailsQuery:Related Details
Add all the fields, NextAdd all the fields, Next Select by State List, nextSelect by State List, next
Tabular layout, nextTabular layout, next
Choose any style, nextChoose any style, next
Titles,Titles,Form=Employee by StateForm=Employee by State MainMainSubform=Employee by StateSubform=Employee by State -- SubSub