One of the jobs of being a database developer or
administrator is to update records when there is a new request. For
example, imagine a company has decided to change the minimum salary of all
employees and the manager gives it to you. If the company is small as
having less than 10 employees, you can easily open the table or the form
that holds the employees records, manually examine the employees with the
lowest salary, and then change those who have a salary below the company's
new set. You can also create an update query that would perform the task.
The job here is to check all salaries but to make a change only to
those that respond to a specific criterion. For example, if you must
change the minimum salary to 8.55, your change would affect only those
employees who are making less than $8.55/hr.
Imagine a company has decided to give a general raise
to all employees, for example $0.35. Once again, for a small company of 10
employees or less, you can simply open the table or the form that holds
employees records, get to the salary column, and add the new raise to each
salary. If the company is medium to large, you cannot take the risk of
doing this manually. Once again, you have various alternatives to solving
this type of problem. For example, you can create an update query using a
SQL statement and perform the task.
As mentioned already, if you try solving this type of
problem manually, you are likely to make a mistake. Solving it with an
update query may not be as friendly because, after creating the query,
since you cannot just hand a query to a "casual" user, you would
then have to either train a user, which could be a waste of time, or
create a form, in which case, you would work twice to solve one problem.
As ADO is not always as difficult as it may appear to be, these types of
problems can be solved with just a few lines of code. The advantage also
is that, as we will do here, you can create a simple for, make it
available to the user who can then fill it up with the desired value,
without your intervention. Of course, the form can also be used more than
once (it can also become dangerous if given to an irresponsible user who
may just decide to give a $10/hr raise to all 750 employees... Sweet).
|