How Update (Access)

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

How-To: Update Records

Introduction One of the jobs of being a or administrator is to update records when there is a new request. For e amp!e" imagine a compan# has decided to

database developer

employees and the manager gi$es it to #ou. If the compan# is sma!! as ha$ing !ess than %& employees" #ou can easi!# open the
change the minimum sa!ar# of a!! tab!e or the form that ho!ds the emp!o#ees records" manua!!# e amine the emp!o#ees with the

!owest " and then change those who ha$e a sa!ar# be!ow the compan#'s new set. (ou can a!so create an update quer# that wou!d perform the tas). The job here is to chec) a!! sa!aries but to ma)e a change on!# to those that respond to a specific criterion. For e amp!e" if #ou must change the minimum sa!ar# to *.++" #our change wou!d affect on!# those emp!o#ees who are ma)ing !ess than ,*.++-hr. Imagine a compan# has decided to gi$e a genera! raise to a!! emp!o#ees" for e amp!e ,&..+. Once again" for a sma!! compan# of %& emp!o#ees or !ess" #ou can simp!# open the tab!e or the form that ho!ds emp!o#ees " get to the sa!ar# co!umn" and add the new raise to each sa!ar#. If the compan# is medium to !arge" #ou cannot ta)e the ris) of doing this manua!!#. Once again" #ou ha$e $arious a!ternati$es to so!$ing this t#pe of prob!em. For e amp!e" #ou can create an update quer# using a /01 statement and perform the tas). 2s mentioned a!read#" if #ou tr# so!$ing this t#pe of prob!em manua!!#" #ou are !i)e!# to ma)e a mista)e. /o!$ing it with an update quer# ma# not be as friend!# because" after creating the quer#" since #ou cannot just hand a quer# to a 3casua!3 user" #ou wou!d then ha$e to either train a user" which cou!d be a waste of time" or create a form" in which case" #ou wou!d wor) twice to so!$e one prob!em. 2s 24O is not a!wa#s as difficu!t as it ma# appear to be" these t#pes of prob!ems can be so!$ed with just a few !ines of code. The ad$antage a!so is that" as we wi!! do here" #ou can create a simp!e for" ma)e it a$ai!ab!e to the user who can then fi!! it up with the desired $a!ue" without #our inter$ention. Of course" the form can a!so be used more than once 5it can a!so become dangerous if gi$en to an irresponsib!e user who ma# just decide to gi$e a ,%&-hr raise to a!! 6+& emp!o#ees... /weet7. 8ractica! 1earning: Updating Records

salary

records

%. /tart 9icrosoft 2ccess and create a new :!an) ;. <reate a new tab!e in 4esign =iew with the fo!!owing fie!ds: <o!umn >ame 4ata T#pe ?mp!o#eeI4 First>ame 1ast>ame Te t Te t

Database named /a!!# /uper 9ar)et


Other 8roperties

2uto>umber 8rimar# @e#

?mai!2ddress Te t /a!ar# <urrenc# .. /a$e the tab!e as ?mp!o#ees and switch it to 4atasheet =iew A. <reate a few records as fo!!ows:
Employee ID First Name Last Name Roberts Keys Ross Kirklan Eisner )o* Ettenson /ray A0uino 1aptain 4aessel 5a+amm Email Address robertsa@sallysuper.com keysj@sallysuper.com rosse@sallysuper.com kirklan t@sallysuper.com eisnerk@sallysuper.com +o*s@sallysuper.com ettensonr@sallysuper.com -rayr@sallysuper.com a0uinos@sallysuper.com captain-@sallysuper.com (aesselm@sallysuper.com -raemea@sallysuper.com la+ammk@sallysuper.com Salary $14.58 $5.22 $22.4" $$.12 $%.54 $1".28 $$.44 $8..2 $12.$8 $1$.54 $5.84 $15.1" $2".28 $%.25 $$.1$ $..2$

1 Anselme 2 Justine 3 E !ar 4 #racey 5 Kimberly $ Jonat&an % 'te(e 8 An re! . Ran y 1" Rebecca 11 'ally 12 /race 13 2enry 14 3att 1$ Kassa

A amson a amsonj@sallysuper.com ,orou-&s borou-&sa@sallysuper.com

#&omason t&omason&@sallysuper.com

15 Ale*an ra /raeme

+. <!ose the tab!e. If #ou want" as an option" generate a form for it

B. <reate a new 5independent7 form and set its <aption to Database Maintenance 6. /a$e it as Database Maintenance

You might also like