macro for making a field value determined by the value of another field

  • Thread starter Thread starter kennethburr
  • Start date Start date
K

kennethburr

I am tried to write a macro (I don't know code) in Microsoft Access
2003 that will place a certain value in a field#2 depending on what
value is in field#1. For example if the value in field#1 is any number
between 0 and 100 then the value of field#2 will be 1, and if the value
of field#1 is any number between 101 and 200 then the value of field#2
will be 3, and if the value of field#1 is any number between 201 and
300 then the value of field#2 will be 10. I just joined this group so
my question may not be in the right format, but I would greatly
appreciate any help.
 
Use RunSQL macro to run this SQL script.

UPDATE Table1 Set Table1.FIELD2 =
IIf(([Table1]![FIELD1]>0 And [Table1]![FIELD1]<101),1,
IIf(([Table1]![FIELD1]>101 And [Table1]![FIELD1]<201),3,
IIf(([Table1]![FIELD1]>201 And [Table1]![FIELD1]<301),10,0)));

hope this will help
 
Your suggestion not only works great, but I actually got it to work on
the first try! Thanks very much for your help!
 
Back
Top