ms access - How to make a query or macro to alter another table -


i have table in access 2007 has list of students , total unit score.

i have query finds students unit values totalled less 17 (if have less 17 points cannot graduate).

i have query finds students unit values totalled more 17 (they can graduate).

how go adding column original table says whether graduate?

basically have this:

 ______|student|___|points|         johnny      18             markus      5      

and want this:

 ______|student|___|points|___|graduation status|______         johnny      18         y         markus      5          n 

how can achieve above?

you can create 2 queries:

  1. adds column
  2. updates column y or n

query add column

alter table table_name  add column gradution_status text 

query update newly added column y or n

update table_name  set graduation_status = iif (points < 17, "n", "y")  

if accidentally ran both queries 2 times, first inform there field existing in table. query stop there, no harm done. 2nd query re-update graduation_status field. no harm there well.

if using office 2010, create column calculated field formula iif(points < 17, "n", "y")


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -