E
Elizabeth Swoope
I need to categorize entries based on the value of a particular field. It
doesn't matter to me whether the new category field is in a query ("best
practices") or whether I write a little code to calculate and fill the new
field as data is entered into the form.
The data goes in as a text field consisting of four digits. Shown below are
the input data and the desired new field value:
1110 -> 1110
1120 -> 1120
1220 -> 1220
1230 -> 1230
1240 -> 1240
37xx -> 3700 (that is, any code beginning with 37 translates to 3700)
everything else become the first digit of the code followed by three zeroes
(e.g., 4235 -> 4000)
If I had only the 37xx and everything else, that's an easy IIF. I've looked
at switch and choose and they don't seem quite right. If I do this in a
query, it appears that I have to create a hellacious statement with a bunch
of nested IIFs.
I hope that I'm missing something very simple here! I can muddle through
writing code to calculate this in a form but I'd rather use a query if
possible.
Any input or advice is appreciated.
Thanks,
liz
doesn't matter to me whether the new category field is in a query ("best
practices") or whether I write a little code to calculate and fill the new
field as data is entered into the form.
The data goes in as a text field consisting of four digits. Shown below are
the input data and the desired new field value:
1110 -> 1110
1120 -> 1120
1220 -> 1220
1230 -> 1230
1240 -> 1240
37xx -> 3700 (that is, any code beginning with 37 translates to 3700)
everything else become the first digit of the code followed by three zeroes
(e.g., 4235 -> 4000)
If I had only the 37xx and everything else, that's an easy IIF. I've looked
at switch and choose and they don't seem quite right. If I do this in a
query, it appears that I have to create a hellacious statement with a bunch
of nested IIFs.
I hope that I'm missing something very simple here! I can muddle through
writing code to calculate this in a form but I'd rather use a query if
possible.
Any input or advice is appreciated.
Thanks,
liz