Field

  • Thread starter Thread starter Adrienne
  • Start date Start date
A

Adrienne

I have a field entitled :

PROG_CLASS_CODE (Some EXAMPLES OF THE FIELD ARE):

M34
I2A
A27
X79

I need to establish a new field entitled:

Divisions

A = DAIDS If the above Program Class Code begins
I = DAIT with an A it will fill the division field
M = DMID with the word DAIDS. If the Program
X = DEA Class Code field begins with and I it will
fill the Division field with DAIT and etc.

How will I write this expression in the new field?
 
I have a field entitled :

PROG_CLASS_CODE (Some EXAMPLES OF THE FIELD ARE):

M34
I2A
A27
X79

I need to establish a new field entitled:

Divisions

A = DAIDS If the above Program Class Code begins
I = DAIT with an A it will fill the division field
M = DMID with the word DAIDS. If the Program
X = DEA Class Code field begins with and I it will
fill the Division field with DAIT and etc.

How will I write this expression in the new field?

I'd suggest that a) your PROG_CLASS_CODE should be split into (at
least) two fields, since it is not atomic; and b) that you create a
Divisions table with two fields, as you have at the end of your
message.

YOu could then create a Query joining the two tables by this
one-letter code. If you don't split PROG_CLASS_CODE you could use an
expression

Divisions: Switch(Left([PROG_CLASS_CODE], 1) = "A", "DAIDS",
Left([PROG_CLASS_CODE], 1) = "I", "DAIT",
Left([PROG_CLASS_CODE], 1) = "M", "DMID",
<etc>

but this embeds a lot of intelligence in hard-to-maintain code; the
table solution would be simpler.


If you want to have the Divisions field in your table, it will NOT
fill in automatically; in fact, it's redundant and should ideally not
exist. But if you want it anyhow, run an Update query using the
Switch() expression above on the Update To line.
 
Back
Top