Vous êtes sur la page 1sur 34

Creating a Database using Access 2007

Starting Access 2007


Double click Access 2007 Windowssee rightclickStartlower left
cornerclickPrograms, clickMicrosoft Access 2007
Getting Started with Microsoft Office Accessappear (image below

For previous Access users:newAccess 2007


Left Mouse Button
In this tutorial, whenever we indicate that you need to click the mouse, it will
mean to click the left mouse button – unless we indicate that you should click
the RIGHT mouse button. So, always “click left” unless we tell you otherwise.

Creating an Access 2007 Database

centerGetting Started with Microsoft Office


Access
ClickBlank Database button
As soon as you clickBlank Database buttonright side of your Access screen will change and
look like the image on the left.
Saving your work
uniqueAccessrequires savedatabaseas soon as
you enter the program
savefloppy disketteA: Drive, USB key/Flash
Drive C: Hard Disk
chooseDriveclicksmall folderrightFile Name:
New File Database
upper left cornerFile New DatabaseseeSave

insee upper left arrow aboveClicksmall down arrowrightdisk drives availablesee right
upper arrow abovedrive on which you want to save your database,click-on it3½
FloppyA:formatted disk in the A driveselectionappearSave in
click-inarearightFile Name:Deletetexttype-in PERSON shownbottom of the above image
see lower left arrow
clickOK buttonEntersee lower right arrow on last page
returnGetting Started with Microsoft Office
Access screenright sidesee your database File
Name belowDrive on which you will create your
database.
ClickCreate button
Creating a Table
clickCreate buttonimage belownew look2007
OfficeTabsRibbonsfor the area in Access on

Tabs
which you’re working

Ribbon

Groups
Noticeimage aboveTable Tools Tablower
Tab/Ribbon has changedDesign
Personnel Tabledoes not “fill” the
screenclicksmall squareminus and the
Xupper right hand cornersee
arrowimageright

NoticeunderBlue BartopDesign
screen3Field name, Data Type,
Description

lower halfField Properties


creatingField Namesdatabaseblankpersonnel form (on paper)filled-inareas that will be

filled inFieldsformsrecords
Significant Notecreatingdatabasebreak downfieldsmallest partsTrust us. This will
save you a lot of time later on.

Look atimagerightClick-
inareaspaceunderField Nametype-
inLast Name (to replace
ID).TapEnter click-inarearight Data
TypecursormovesData
TypeClickdown arrow Data
Typerightlook likeright
Now we’ll talk about Data Types.
Data Type
Text
Memo
Number
Date/Time
Currency
AutoNumber
Yes/No

OLE Object
Last NameTextDescription
noticelowerField Properties,box appearedselectedText Data TypetailoredtoTextField
Properties should look like the one belowfinishstepsbelow

Field Properties
Click-in each area (to the right of the words) as you read about it below
Field Size currently set255click-
inareachange25
Format clickFormat AreatapF1 function keyHelp

FormatHelptailored toHelp Window appearsclickFormat Property


clickText and Memo Data TypesclickXupper right cornerMicrosoft Access Help – Format
Property close
Input Mask
Caption
Default Value

Validation Rule

Validation Text
Required

Allow Zero Length


Indexed
Unicode Compression
IME Mode

IME Sentence Mode


Smart Tags
repeatprocesscreate different Field Names Data TypesType-inField Namesbelowset
themData TypesSizes indicated
Field Name Data Type
Size
Last name Text
25
(Already
Completed)
First name Text 20
Social Security # Text 15
We'll use Input Mask Social Security NumberClickinInput Mask area Field Properties
bottom screen left arrow below

Noticethree "dots" (...)rightClickthreeright arrow aboveInput Mask WizardMust Save


Table FirstSave Now?
ClickYes

Save Asmaytype-inPersonnel Table


NameclickOK
Input Mask
WizardshowSample
MasksSocial Security Number
click-on itscreenlook likebelow
clickNextbottomInput Mask
Wizard screen
seedefault number000-00-
0000dashes (-) between the
numbers
clickNext> again
see two
choicesClickinlittle
circleleftWith
symbols in the
mask, like this
Next> again
click
Finish
seespecialwrittenInput Mask
areaSocial Security #
Street address Text 25
City Text 20
State Text 2

Here we'll use Format 2right of Format

down pointingarrowlikeabovesee arrow,appear rightFormat areaclickTap F1 key


Function Keys top keyboard. Help menu screen tailoredFormatappearbelow)
FormatHelptailored toHelp Window
appearsclickFormat Property

working withText Data TypeclickText and


Memo Data Typesarrow below
Notice >any alphabetic characterall upper case letterspointclickXupper right hand corner
of the Format Help Screen

type >FormatField Propertieslook likebelow

Zip Text 5
Gender Text 1
Insert a >Formatall gender upper case (capitals -State

Favorite Number Number


Numbers,Validation Rule Validation Text1 and 999Field SizeLongInteger
clickarearightDecimal PlacesAutodown arrowrightClickarrow0

click Validation Rulebuildmathematical expressiononly allow numbers from 1 to 999.


Typefollowing expression
> 0 and < 1000

noticeclickValidation Rule areathree periods (…)appearPlease noteExpression Builder can


cause problems<<expr>><<expr>><<expr>>.
does notnumber correctlywe'll createerror messagClickValidation Texttype-in
Favorite Number must be between 1 and 999.
When you finish all of the above, your Field Properties should look like the one below

Date hired Date/Time


Format areaclick small down arrowright sideShort DateInput Maskclick
three dots (...) Save the table Short Date clickNext>click Next>
againclickFinish/
Your Field Properties should look like the image below

Salary Currency

Decimal Placesclicksmall down arrowright side0 0 (zero) rightDefault


Value. 0
Application Received Yes/No

Yes/No

good time to Save the last few changes


Microsoft Office Button
Microsoft Office Buttonreplaced
Fileupper left cornerseeimage
rightMicrosoft Office Button
ClickMicrosoft Office Button
noticemany of the “old” File-Menu
Bar choicesincluded in this menu
Saved databasebeginningclickSave

Quick Access Toolbar


also clicksmall disketteQuick Access
Toolbar
Entering data in the database
you will still be in the Design view first
button on the left that has a small sheet
of paper
arrowrightViewPointbuttonpauseTool
Tipindicatesbutton isView
ButtonClickView
clickViewall of the Fields you created

Field Namescut off


enter data in each Field

Widening Columns in Datasheet View


widen columnsseeField
Namesmove your cursor over the
“line” between two Field Names
(image above)cursor was over the
line betweenline with two arrows
pointing left and rightsee this lineclickhold down the left mouse buttonmove your cursor to
the right a bitcolumnlargertake your finger off the mouse button

One noteValidation Ruleif we try to widen a column we will get the Validation Rule error
messageSo, it’s best to only widen columns when you are not entering data.
Entering Data

Last Nameseeflashing cursorthat you are ready to begin entering datatype the
datatapEnter,click with the mouse in each fieldretype
type the following in the area below the Field Name
Field Name To be typed
Smith
Fred
123-45-6789
100 Main Street
Lynchburg
va
24501
mf
2007
07/01/1993
40000
Pointlittle squareclickleftseecheck mark
notice
Social Security Number Date Hired seeInput Mask work
StateGender noticeFormat>forcedletter(s)capitals
Favorite Number Favorite Numbertoo bigwillerror messageClickOKcreatewill work
Salary - Currency$commasperiods

Whencompleted typingEnter
Noteautomatically saved

Also note*
2methodsenteringdata into the database
Datasheet View
or
Form View ()

Exiting and Saving


click Microsoft Office Buttonupper left corner Access
screen, clickExit Access – lower right corner menu
screenhave not savedasking you to do so
Notice Access Options buttonleftExit AccessClickAccess Options button. Access Options
menu screen (top of next page)appear

clickResources
clickExit Access button.
Do you want to save?click Save file screenclickOK
Opening Access Database - again
neat thingOpen Recent Database area on the
right side of the

screenseedatabaseOpenarrowimagerightclickfilePerson
ClickOptions

ClickOptions

clickOKseeleftPersonnel:Table turns orangemeans that it is OKtwo choices


movecursoroverorange areaclick the LEFT mouse button twice quickly
movecursoroverorange areaclick
the RIGHT mouse button.drop
down menuclickOpen
continue enteringdataDatasheet View
Form View and Datasheet View
really different than in previous versions
look at the topAccess
screenclickCreate
TabCreate
Ribbonforms
GroupClickForm
button
screen change
significantlyknowing
you were entering
data from the
Personnel
Tablecreated a
Formwith all of the
Fields in your Table!
PersonnelFormlookbelow
new featureTab layoutabove Formseetwo

TabsNotice the small image on the left of each Tableft TabDatasheetright


TabFormclickwhichever Tab
enter dataForm ViewsameDatasheet
ViewSaveFormclickSmall Save Diskette Quick Access
Toolbarformpart of your Person Databaseautomatically
saveTab Name
move your cursor over the Personnel Form
TabclickRIGHTmouse buttonclickSave
formPersonnelbottomForm screena status area (see
below)arrow with an asterisknew blank record
first “open”Person Databasechooseyour
favoriteFormDatasheetLookleft sideAll
TablesPersonnel Table two selectionsPersonnel:
TablePersonnel.Noticeimageon the left of each
selectionswitch back and forthDatasheet
entryForm entryclickingyour choice
lower left cornerof the menuscreenseesome text
that indicates that you are either using Form or Datasheet

View to enter your data


Viewbuttonsupper left
indicateview Design View, Form
View, Datasheet Viewmove
back-and-forth between
viewsclickingdown trianglesee
arrows and images

Note Sav Form


Important
To record enough information so that you can see the power of Access database does enter
24 or more records nowForm ViewDatasheet View

Querying the Database


This is what a database is designed forfinding specific informationdatatablevery
quicklysearch for general specific data in a field fieldsclick on the fields we want to
queryfinding just Last Names table
are not in Database: PERSONscreenshowsTables, Queries, etcfollowing the instructions on
Pages 21-24 .
Ifyou have the Personnel Datasheet Personnel Form openclose them
Accessconfused
RIGHT clickDatasheetForm Tabsselect Close
ClickCreate Tabtopleft arrow abovemovecursoroverQuery Design ButtonCreate
Tab/Ribbon (right arrow above).
imageright
ClickQuery Design button

TwoQuery 1: TabShow Tablefirstselect the table(s) you desire to queryShow Table


screenlook likebelow

Show Click Add First


Table Then click Close

Query 1: Queryappear

Clickexpansion
squareupper right corner
enlargethe Query 1: Select Query
upper half of the window,small boxPersonnelasterisk (

These areas
are
magnified
below

* )belowelevatorfields PersonnelTable
Fields we want to query lower areaNoticelower areaon the left borderField:, Table, Sort:,
Show:, Criteria:, or:
clickinfirst cell to the right of Field:Last Name, State,
Favorite NumberSalaryclickdown arrow click Last
NameNoticeLast Name appearsrightField
checkseenShow meansseeLast
NamesNotice,rightTablePersonnel
query screenlook likeone on
the right
movenext Field cell on the
rightdown
arrowclickStatenext two
fields to the rightFavorite
Number Salary
look Button Bar top left screenmiddleseeexclamation
mark! rightRun Click-on the! click executes your query

Notice ONLYfour fields

addremovefields,returnDesign ViewreturnDesign Viewclicksmallbuttonupper


left cornerscreenblue triangle, pencil, and ruleronerightclickField areaselect a
new fieldreplacefield you want to removetapDelete key
seequerywill look,print how to open
Print Preview

clickMicrosoft Office Buttonupper


leftmovecursorPrint selectionPreview
and print the viewappearMovecursor
over Print Previewclick
clickleft mouse button once“zoom”
inenlargeclickagainzoom out
returnclick-on Close Print Preview
button
on the
right
side of the
Print
Preview

Tab/Ribbon.View

Adding a Print Preview Button to the Quick Access Toolbar.

addPrint Preview buttonQuick Access Toolbar


Repeatsteps at the top of this
pagePrint
PreviewclickRIGHTmouse
buttondrop down menuclickAdd to
Quick Access Toolbar
add any button you desiresmall
arrow on the right side of the
Quick Access
Toolbarrightmovecursorover
arrowCustomize Quick Access
Toolbar
Sorting the Database
Query Design ScreengoDesign ScreenNoticethird row,
lower half Sort: imagerightClickSortLast Namedown
arrowappearsclick-on the down arrowLast
NamesAscendingClickAscendingAscending Click-on
the!new query Click-on the Design View button (triangle-
ruler-pencil)changeAscending(not sorted) set the fields to (not sorted)
may also sortfieldsDatasheet ViewTableQuerythe Field Namestop of each column in gray
cells
click-on oneblue area field
namesStateentire
columnblueimage
rightmarked
Home Tab/Ribbonright sideSort & Filter Groupsee two
buttons with “down” arrows imagerightmovecursor over
these two buttonstext helpindicateSort AscendingSort
Descendingclick-on oneFieldselectedsortedin the order
selected
always click the Undo ArrowQuick Access Toolbar

New to Access 2007 – A Filter/Sort Arrow for each Field!


imagerightclickedsmall down
arrowrightStatedrop down Filter/Sort
menu appearedNotice

Specific Queries
everythingeach Field Namefind
somethingspecificpeople from a certain
state or city, people whose favorite number
is 7 or salaries between $ 20,000 and $
50,000tricky
idea of various criteriaclick Help
Question Mark upper right corner
Access Screen
Access Help Task Pane
appearrightNoticenumber of Help
topics
clickSearchType-inquery
criteriatapEnter key

Search for: right

ClickExamples of query criteria


Access
HelpappearClickMaximize
squareupper right corner
UseElevator BarrightHelp
screenviewcriteria
finishedclickXupper right
cornerMicrosoft AccessHelp
Topics menuclose
Now we'll try a few specific
queriesfindspecific state
Query1: Select QueryDesignlook
likeIf you’re notclickDesign
buttonupper left cornerscreenright
Clickcell right of Criteria:StateMake sure you are in the State columnType-
inabbreviationfor one of the states you enteredlook likeimage below

click-on( !Only state you selected

SPECIFICstate
Design View Button (triangle-ruler-pencil)
Delete state
Favorite Numbers larger than 600Type-in>600 Criteria cellFavorite Number Column.

Click-on!no one is indicateddon't


havenumber larger than 600

Return toDesign ViewDelete


>600run the query with no
criteriaseethefieldsReturn
toDesign View
Make sure all the Criteria: cells are empty
salaries equal to or larger than $ 20,000 and equal to or less than $ 50,000Salary:type-in

>= 30000 and <= 40000


Click-on!

Go back to Design

ViewDeletecriteriaSalary
on your own
Don't get frustrated if no specific items appearcan't existandor:Try one state in the
Criteria: cell under State and another in the or: cell.
end
Make sure that your query is completely clear of criteria
RIGHT click Query1 Tab. Movecursorover
SaveclickSave
Save AsName the Query anything you
likeour query “Test Query 2007ClickOK
clickOKnotice t
closeQueryRIGHTTabclickingClose
openquery againclick twice quickly on the
queryRIGHTclickquerychooseOpen

Reports
Reports can be very
complexvery basic steps A good
manual or some knowledgeable
assistance will be essential to
mastering reports.
Wizards Tabs/Ribbons
For those who are accomplished with
Access reports – from earlier versions
of Access – this will be a whole new adventure with the Tab/Ribbons of 2007 Office.
First, make sure that you have closed any Tables, Forms, or Queries on which you are open
Accessshould look similarimage below
ClickCreate TabCreate Ribbon will appearLookrightCreate Reports Group

Create Reports GrouprightReport Wizard


ClickReport WizardReports Group
Report Wizard Menuappear

Read all the information Report


Wizard menu screenyou
selectyourwill show-in the report
individuallyclickname
fieldAvailable Fields:click>
orderwhich you click will be their
order >> brings over all of the
fields < brings back one of the
fields which you have selected
<< brings back all of the
fields.make a mistake
Lookimage aboveNoticearrowpointingdown
arrowright sideTables/Queries
areaClickarrowselectTable:Personnel
Your Report Wizard menu screen should look
like the large image in the middle of this page.
Click-on First Name click-on
>noticefromAvailable FieldsSelected Fields Last Name, State, Gender Salary
should look likebelow
Next>
Grouping in Reports
GroupingstateclickState ><
look likebelow

Next>
FirstaboveindicateSort OrderalphabeticorderLast NameFirst NameAscendingClick-onthe
small down arrow to the right of the first box Last NameAscendingFirst Namescreen
should look likeabove
Summary Optionsbelow sort fieldsONLY appearsnumber field is selectedClick- Summary
Options… button
Summary Optionsallowsentercalculationsnumericalcurrencyselectedsummarizeby each
groupintotalSalarycurrencyClickboxesSumAvg

ClickOK. Next>
select a

layoutreportClicksmall circleslefteach choiceLayout areawe’ll stay with the default:


Steppedclick-again it that circle
Note:bottomlast Report Wizardmenu screenon the last pageAdjust the field width so
all fields fit on a pageThis is a very important checkthis is where an advanced
course or manual are almost essential
Next>

StyleClickchoicesNext>
lastNotesmall circlePreview the Reportclick Finishpreview copytitleState ReportFinish
Tabular

Notice#### symbolsunder Salaryright of Sum and AvgThefields are not wide enough to
display these numbers
Noticeupper left CornerLayout Viewclicksmall down
arrowunder Viewdrop down menurightappear

really seeState Report will look likePrint PreviewclickPrint


Preview selectionmenurightclickPrint Preview buttonQuick
Access Toolbartop left

Print Preview image belowseeSalary, SumAverageamountscut


offneed to go to the Design Viewenlarge these “boxes

Noticelower left corner

Noticetriangle arrow”
buttonsleftright

Noticecursormagnifying glassclickzoom inzoom out

returnState Reportclick-on
Close Print Preview button
right side Print Preview
Tab/Ribbon.LayoutView

State Report####
Clickdown arrow belowView buttonupper left cornerAccess
screenclickDesign View
We’ll explain about what you see in the image above on the next page.
New Report Design Tools Tab/Ribbon in Access 2007
First: : Report Header, Page Header, State Header, Detail, State Footer, Page Footer and

Report Footer .
Report Header first

Page Header eachtop of each column

State Header

State Footer

Detail field names from our databasepulldata

These are the databasefields themselvesprint each timeis drawnAs you enter more people in
the database more people will be shown

Page Footer

Report Footer

lower right cornersState


Report Footer
= SUM([Salary]).

Enlarging the Salary, Sum and Average “boxes”

Salary, SumAverage cut offhow to widen the boxes


Design ViewclickSalary boxDetail areaborder around the box will turn
orangemovecursorright side of the boxseetwo-headed arrowDetailimage below

clickHOLD DOWNLEFT mouse buttonmove your cursor slowly to the rightSalary box get
largerTake your finger off the left mouse buttonSalary boxSalary Headerlook
similarimagerightIf you have not made the area large enough, or too large, you can return
to the Design View and adjust as need be
State Footer areado the sameSum box.

Average box

ClickPrint
Preview
buttonPage 44

Saving
Reports

movecursoroverState Report
TabclickRIGHTmouse buttonclick Save
Close this report again
Quick Reports
Reports very complex, very quicklyMicrosoft Press Access 2007 – Inside Out
finishedexit AccessPage 19

Microsoft Office Tutorials


http://www.officetutorials.com
murray.t@lynchburg.edu

Thank you for your patience and good luck.

Vous aimerez peut-être aussi