Modifying Tables

Embed Size (px)

Citation preview

  • 8/8/2019 Modifying Tables

    1/59

    11

    Modifying TablesModifying Tables

    MidtermMidterm

  • 8/8/2019 Modifying Tables

    2/59

    22

    Selecting one or more FieldsSelecting one or more Fields

    AA FieldField ClickClick thethe fieldfield namename

    AA BlockBlock ofof FieldsFields ClickClick thethe firstfirst ininthethe block,block, holdhold downdown Shift,Shift, andand clickclickthethe lastlast fieldfield

    MoreMore CategoriesCategories FieldsFields HoldsHolds

    downdown CTRLCTRL asas youyou clickclick thethe fieldsfields AllAll FieldsFields DoubleDouble--clickclick thethe titletitle barbar

    ofof thethe fieldfield listlist oror clickclick thethe asteriskasterisk

  • 8/8/2019 Modifying Tables

    3/59

    33

    How to Rearrange, Insert &How to Rearrange, Insert &

    Delete FieldsDelete FieldsTo moveafieldTo moveafield

    To deleteafieldTo deleteafieldTo insertanew fieldTo insertanew field

  • 8/8/2019 Modifying Tables

    4/59

  • 8/8/2019 Modifying Tables

    5/59

    55

    How to Copy, MoveHow to Copy, Move

    or Delete Data oror Delete Data orRecordsRecords

  • 8/8/2019 Modifying Tables

    6/59

    66

    Reasons why you have aReasons why you have a

    Primary KeyPrimary Key To view recordinaform orDatasheetTo view recordinaform orDatasheet

    to bearrangedina Primarykey orderto bearrangedina Primarykey order

    To allow automaticcreation ofindexTo allow automaticcreation ofindexthatspeeds up queriesand otherthatspeeds up queriesand otheroperationsoperations

    To ensureyourrecordis uniquelyTo ensureyourrecordis uniquelyidentifiedandpreventsnew data withidentifiedandpreventsnew data withthesame Primarykeythesame Primarykey

  • 8/8/2019 Modifying Tables

    7/59

    77

    How to create a Primary KeyHow to create a Primary Key

    ChooseChoose thethe fieldfield youyou wantwant toto setsetasas aa PrimaryPrimary keykey

    FromFrom thethe Toolbar,Tool bar, clickclick thethePrimaryPrimary key,key, oror setset thethe EditEdit menumenu

    toto clickclick thethe PrimaryPrimary KeyKey.. AA keykeysymbolsymbol appearsappears toto thethe leftleft ofof thethefieldfield namename youyou hadhad setset asas PKPK..

  • 8/8/2019 Modifying Tables

    8/59

    88

    Primary KeyPrimary Key

    UniquelyidentifieseachrecordUniquelyidentifieseachrecord

    storedinthetablestoredinthetable

  • 8/8/2019 Modifying Tables

    9/59

    99

    Types of PrimaryTypes of Primary

    KeysKeys

  • 8/8/2019 Modifying Tables

    10/59

    1010

    1.Autonumber PK1.Autonumber PK

    Itcanbesetto automaticallyenterItcanbesetto automaticallyenter

    asequential numberaseachasequential numberaseach

    recordisaddedto thetablerecordisaddedto thetable

    Designatingsuchafieldasthe PKDesignatingsuchafieldasthe PK

    foratableisthesimplest waytoforatableisthesimplest waytocreatea PKcreatea PK

  • 8/8/2019 Modifying Tables

    11/59

    1111

    2.Single2.Single--Field PKField PK

    IfIf youyou havehave aa fieldfield thatthat containscontainsuniqueunique valuesvalues suchsuch asas IDID numbersnumbers

    oror part part numbers,numbers, youyou cancandesignatedesignate thatthat fieldfield asas PKPK

    IfIf thethe fieldfield youyou setset asas PKPK doesdoeshavehave duplicateduplicate oror NullNull values,values,AccessAccess wontwont setset thethe PKPK

  • 8/8/2019 Modifying Tables

    12/59

    1212

    MultipleMultiple--Field PKField PK

    InIn situationssituations wherewhere youyou cantcantguaranteeguarantee thethe uniquenessuniqueness ofof anyany singlesingle

    field,field, youyou maymay be be ableable toto designatedesignatetwotwo oror moremore fieldsfields asas PKPK..

    TheThe mostmost commoncommon situationsituation wherewhere thisthis

    arisesarises isis inin thethe tabletable usedused toto relaterelate twotwootherother tabletable inin manymany--toto--manymanyrelationshiprelationship

  • 8/8/2019 Modifying Tables

    13/59

    1313

    How to Add a NewHow to Add a New

    RecordRecord

  • 8/8/2019 Modifying Tables

    14/59

    1414

    Data EntryData Entry

    Hidesall theexistingrecords,andHidesall theexistingrecords,and

    immediatelydisplaysblankimmediatelydisplaysblank

    recordinthedatasheet.recordinthedatasheet.

    Choose RecordmenuChoose Recordmenu DataData

    EntryEntry

  • 8/8/2019 Modifying Tables

    15/59

    1515

    How to Hide /How to Hide /

    Unhide ColumnsUnhide ColumnsFormatFormat Hide/UnhideHide/Unhide

    ColumnsColumns

  • 8/8/2019 Modifying Tables

    16/59

    1616

    Modify theModify the

    Structure of a TableStructure of a Table

  • 8/8/2019 Modifying Tables

    17/59

    1717

    IndexingIndexing

    TheThe processprocess inin sortingsorting thethe fieldfieldalphabetically,alphabetically, numerically,numerically, oror

    chronologicallychronologically.. OnceOnce aa fieldfield isis indexed,indexed, itit speedsspeeds

    upup sorting,sorting, andand searchingsearching whilewhileAccessAccess updatesu pdates thethe indexindex wherewhereeacheach oneone addsadds oror changeschanges aa recordrecord

  • 8/8/2019 Modifying Tables

    18/59

    1818

    How To ChangeHow To Change

    Column Width AndColumn Width And

    RowH

    eightRowH

    eight

  • 8/8/2019 Modifying Tables

    19/59

    1919

    FilterFilter

    AA stringstring expressionexpression consistingconsisting

    ofof aa wherewhere clauseclause withoutwithout thethe

    wherewhere keywordskeywords

  • 8/8/2019 Modifying Tables

    20/59

    2020

    Types of FilteringTypes of Filtering

  • 8/8/2019 Modifying Tables

    21/59

    2121

    Filter by FormFilter by Form

    ThisThis isis aa blankblank versionversion ofof thethe

    activeactive formform oror datasheetdatasheet soso youyou

    cancan filterfilter datadata

    TypeType thethe keywordkeyword ofof thethe datadata

    youreyoure filteringfiltering

  • 8/8/2019 Modifying Tables

    22/59

    2222

    Filter by SelectionFilter by Selection

    FiltersrecordsbyselecteddatatoFiltersrecordsbyselecteddatato

    filterbyselectionfilterbyselection

  • 8/8/2019 Modifying Tables

    23/59

    2323

    Controlling the FieldControlling the Field

    PropertiesProperties

  • 8/8/2019 Modifying Tables

    24/59

    2424

    FormatFormat

    Itisaphysical arrangement ofItisaphysical arrangement of

    fieldnamesanddatafieldsinfieldnamesanddatafieldsin

    datadata--entryformdisplayed onentryformdisplayed on--

    screen.screen.

  • 8/8/2019 Modifying Tables

    25/59

    2525

    Format Property SettingFormat Property Setting

    ItIt isis usedused toto setset aa varietyvariety ofof

    predefinedpredefined displaydisplay formatformat forfor anyany

    fieldfield thatthat hashas thethe FormatFormat propertyproperty

    includingincluding Number,Number, Currency,Currency,

    Autonumber,Autonumber, Date/Time,Date/Time, Text,Text,Yes/NoYes/No andand MemoMemo datadata typestypes

  • 8/8/2019 Modifying Tables

    26/59

    2626

    Date/TimeDate/Time

    UsuallyUsually appearappear inin formsforms andand

    reportsreports andand datasheetsdatasheets

    TheyThey cancan appearappear inin table,table, howeverhowever

    thethe datadata isis storedstored inin 6464--bitbit floatingfloating

    pointpoint numbernumber

  • 8/8/2019 Modifying Tables

    27/59

    2727

    Format Date/TimeFormat Date/Time

    Data TypesData Types

  • 8/8/2019 Modifying Tables

    28/59

    2828

    General Date FormatGeneral Date Format

    Displaysthetype ofinformationDisplaysthetype ofinformationcontainedinthefield;ifthefieldcontainedinthefield;ifthefield

    containsbothdataandtime value,containsbothdataandtime value,thecombination ofdateandtimethecombination ofdateandtimeisdisplayed;butifitis onlytheisdisplayed;butifitis onlythe

    time value,thenthetimealoneistime value,thenthetimealoneisdisplayed.displayed.

  • 8/8/2019 Modifying Tables

    29/59

    2929

    Long Date FormatLong Date Format

    ShowsthatdatedisplayistheShowsthatdatedisplayisthe

    sameasthe Long DateFormatinsameasthe Long DateFormatin

    the Regional SettingsSectionthe Regional SettingsSection

  • 8/8/2019 Modifying Tables

    30/59

    3030

    Medium DateMedium Date

    WhereWhere thethe datedate isis displayeddisplayed usingusingdddd--mmmmmm--yyyyyyyy;; dddd representsrepresents thethe

    dayday ofof thethe monthmonth usingusing twotwonumericnumeric digits,digits, mmmmmm meansmeans thethefirstfirst threethree lettersletters ofof thethe Month,Month,

    yyyyyyyy representsrepresents fourfour digitsdigits ofof thetheyearyear

  • 8/8/2019 Modifying Tables

    31/59

    3131

    Medium Time FormatMedium Time Format

    ShowsShows thethe timetime displayeddisplayed inin

    thethe f ormatformat hhhh::mmmm AM/PM,AM/PM,

    wherewhere hhhh representsrepresents anan hourhour

    usingusing twotwo numericnumeric digitsdigits ((0000 toto

    2323)) andand mmmm representsrepresents thetheminuteminute inin twotwo numericnumeric digitsdigits

  • 8/8/2019 Modifying Tables

    32/59

    3232

    Format Number andFormat Number and

    Currency DataCurrency DataTypesTypes

  • 8/8/2019 Modifying Tables

    33/59

    3333

    General Number FormatGeneral Number Format

    ShowsthenumberdisplayedShowsthenumberdisplayed

    almostthesameasyou enteritalmostthesameasyou enterit

    Ifyou type756,it will displayIfyou type756,it will display

    756756

  • 8/8/2019 Modifying Tables

    34/59

    3434

    Currency FormatCurrency Format

    ShowsthenumberdisplayedShowsthenumberdisplayed

    usingcurrencysign,commas,andusingcurrencysign,commas,and

    two decimal pointstwo decimal points

    Ifyou type7890.900,it willIfyou type7890.900,it will

    display like $7,891.00display like $7,891.00

  • 8/8/2019 Modifying Tables

    35/59

    3535

    Fixed FormatFixed Format

    Showsthenumberdisplayed withShowsthenumberdisplayed with

    two decimal placestwo decimal places

  • 8/8/2019 Modifying Tables

    36/59

    3636

    Standard FormatStandard Format

    Showsthenumberdisplayed withShowsthenumberdisplayed with

    commasandtwo decimal placescommasandtwo decimal places

  • 8/8/2019 Modifying Tables

    37/59

    3737

    Percent FormatPercent Format

    ShowsShows thethe numbernumber multipliedmultiplied byby

    100100 andand appendappend aa percent percent signsign

    ((%%)) withwith twotwo decimaldecimal placesplaces

  • 8/8/2019 Modifying Tables

    38/59

    3838

    Scientific FormatScientific Format

    ShowsShows thethe numbernumber displayeddisplayed

    usingusing scientificscientific notationnotation

  • 8/8/2019 Modifying Tables

    39/59

    3939

    Slash (/)Slash (/)

    UsedasdateseparatorUsedasdateseparator

    Thismust varyaccordingto theThismust varyaccordingto the

    timeseparatorestablishedinthetimeseparatorestablishedinthe

    Regional Setting ofControl PanelRegional Setting ofControl Panel

  • 8/8/2019 Modifying Tables

    40/59

    4040

    Colon (:)Colon (:)

    UsedasatimeseparatorUsedasatimeseparator

    Thismust varyaccordingto theThismust varyaccordingto the

    timeseparatorestablishedinthetimeseparatorestablishedinthe

    Regional Setting ofControl PanelRegional Setting ofControl Panel

  • 8/8/2019 Modifying Tables

    41/59

    4141

    Validation Rule PropertyValidation Rule Property

    Setsconditions orexpressionsforSetsconditions orexpressionsfor

    testing validentriestesting validentries

    Usedto checkthe valueenteredUsedto checkthe valueentered

    into afieldinto afield

  • 8/8/2019 Modifying Tables

    42/59

    4242

    ExpressionsExpressions

    ToolsTools utilizedutilized byby thethe developerdeveloper toto

    givegive powerpower toto applicationsapplications

    AA combinationcombination ofof operators,operators,

    constants,constants, literalliteral valuevalue andand

    functionsfunctions thatthat evaluateevaluate aa singlesinglevaluevalue

  • 8/8/2019 Modifying Tables

    43/59

    4343

    Parts of anParts of an

    ExpressionExpression

  • 8/8/2019 Modifying Tables

    44/59

    4444

    OperatorsOperators

    SymbolsthatareprevalentinSymbolsthatareprevalentin

    Booleanalgebra like otherBooleanalgebra like other

    symbolssymbols

  • 8/8/2019 Modifying Tables

    45/59

    4545

    ConstantsConstants

    Numberorstring valuesdontNumberorstring valuesdont

    changechange

  • 8/8/2019 Modifying Tables

    46/59

    4646

    Literal ValuesLiteral Values

    ExactrepresentationssuchasExactrepresentationssuchas

    numbers,stringsanddatesnumbers,stringsanddates

  • 8/8/2019 Modifying Tables

    47/59

    4747

    FunctionsFunctions

    Proceduresthatreturna value:forProceduresthatreturna value:for

    example,Now returnsthecurrentexample,Now returnsthecurrent

    datedate

    Operatesimilarlyto operatorsbutOperatesimilarlyto operatorsbut

    theyare notrepresentedbytheyare notrepresentedbysymbolssymbols

  • 8/8/2019 Modifying Tables

    48/59

    4848

    Field NamesField Names

    NamesNames givengiven toto fieldsfields inin aa tabletable

    ItIt mustmust bebe surroundedsurrounded byby bracketsbrackets

    ifif namename isis mademade upup ofof twotwo oror

    moremore wordswords

  • 8/8/2019 Modifying Tables

    49/59

    4949

    Arithmetic OperatorsArithmetic Operators

    UsedUsed toto executeexecute mathematicalmathematical

    calculationscalculations betweenbetween twotwo oror moremore

    numbersnumbers

  • 8/8/2019 Modifying Tables

    50/59

    5050

    Concatenation OperatorConcatenation Operator

    UsedUsed toto bringbring stringsstrings togethertogether

    && -- brings brings twotwo fieldsfields togethertogether asas

    oneone fieldfield ++ -- brings brings twotwo variablevariable numbernumber

    fieldsfields togethertogether andand sumssums themthem.. ItIt

    cancan alsoalso bebe usedused toto bringbring togethertogethertwotwo texttext stringsstrings togethertogether butbut ititdoesdoes notnot sumsum thesethese texttext stringsstrings

  • 8/8/2019 Modifying Tables

    51/59

    5151

    Comparison OperatorComparison Operator

    UtilizedUtilized BooleanBoolean symbolssymbols andand

    areare usedused toto performperform

    comparisoncomparison betweenbetween twotwo oror

    moremore fieldsfields oror expressionsexpressions

  • 8/8/2019 Modifying Tables

    52/59

  • 8/8/2019 Modifying Tables

    53/59

    5353

    Order ofOperationsOrder ofOperations

    WhenWhen operationsoperations fr omfrom thethe samesame

    groupgrou p appearappear inin anan expression,expression, thethe

    predeterminedpredetermined orderorder taketake placeplace TheThe arithmeticarithmetic operatoroperator areare first,first,

    followedfollowed by by concatenation,concatenation,

    comparison,comparison, andand logicallogical operatorsoperators;;

    thisthis isis calledcalled OperatorOperator PrecedencePrecedence

  • 8/8/2019 Modifying Tables

    54/59

    5454

    ConstantConstant

    ItIt cancan bebe usedused inin expressionexpression too,too,

    likelike AccessAccess reservedreserved wordswords inin thatthat

    thethe numericnumeric oror stringstring valuevaluedoesntdoesnt changechange duringduring programprogram

    executionexecution

  • 8/8/2019 Modifying Tables

    55/59

    5555

    Groups of ConstantsGroups of Constants

  • 8/8/2019 Modifying Tables

    56/59

    5656

    Predefined ConstantPredefined Constant

    ConstantsthatthedeveloperConstantsthatthedeveloper

    creates likeinmodules.Itbeginscreates likeinmodules.Itbegins

    withthe letters CONSTwiththe letters CONST

    Thesethingsholdtrueno matterThesethingsholdtrueno matter

    whatthecircumstanceswhatthecircumstances

  • 8/8/2019 Modifying Tables

    57/59

    5757

    Intrinsic ConstantIntrinsic Constant

    Constantappliedby Visual BasicConstantappliedby Visual Basic

    Itcanbedividedinto sixItcanbedividedinto six

    categories:dataaccessconstants,categories:dataaccessconstants,

    macro actionconstants,securitymacro actionconstants,security

    constants, variantconstants,andconstants, variantconstants,andmiscellaneousconstantsmiscellaneousconstants

  • 8/8/2019 Modifying Tables

    58/59

    5858

    SystemSystem--Defined ConstantsDefined Constants

    Have onlyfivesystemHave onlyfivesystem--defineddefined

    constants:Yes,No,Off,Onandconstants:Yes,No,Off,Onand

    NullNull

  • 8/8/2019 Modifying Tables

    59/59

    5959

    Variable NamesVariable Names

    Alternativenamesforfields orAlternativenamesforfields or

    expressionsto createashorterexpressionsto createashorter

    referencereference

    Itis likeamemoryplaceholderItis likeamemoryplaceholder