If... Then.. statements in Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I use "If - Then" logic to convert a bunch of null values into some
other value (in this case, the number 4).

For example, my existing table looks like this

Entry Book GRADE New Column
a Dante 3
b Keats
c Yeats 4
d Neruda
e Hemingway 3
f Homer 2

What I want to do is something along the lines of "if [grade] = Is Null,
then [New Column] = 4". HOWEVER, I don't know the correct syntax.
ADDITIONALLY, how do I write this so that the [New Column] still includes the
grades that are NOT null.


This is what I am trying to create.

Entry Book GRADE New Column
a Dante 3 3
b Keats 4
c Yeats 4 4
d Neruda 4
e Hemingway 3 3
f Homer 2 2



Happy New Year HELP!

Thanks!
 
How can I use "If - Then" logic to convert a bunch of null values into some
other value (in this case, the number 4).

For example, my existing table looks like this

Entry Book GRADE New Column
a Dante 3
b Keats
c Yeats 4
d Neruda
e Hemingway 3
f Homer 2

What I want to do is something along the lines of "if [grade] = Is Null,
then [New Column] = 4". HOWEVER, I don't know the correct syntax.
ADDITIONALLY, how do I write this so that the [New Column] still includes the
grades that are NOT null.

This is what I am trying to create.

Entry Book GRADE New Column
a Dante 3 3
b Keats 4
c Yeats 4 4
d Neruda 4
e Hemingway 3 3
f Homer 2 2

Happy New Year HELP!

Thanks!

Where are you doing this?
In a query, include the Entry, Book and Grade fields.
Then add a new column.
NewColumn:IIf(IsNull([Grade]),4,[Grade])

In a report, use an unbound control:
As it's control source, write:
=IIf(IsNull([Grade],4,[Grade])
 
How can I use "If - Then" logic to convert a bunch of null values into some
other value (in this case, the number 4).

For example, my existing table looks like this

Entry Book GRADE New Column
a Dante 3
b Keats
c Yeats 4
d Neruda
e Hemingway 3
f Homer 2

What I want to do is something along the lines of "if [grade] = Is Null,
then [New Column] = 4". HOWEVER, I don't know the correct syntax.
ADDITIONALLY, how do I write this so that the [New Column] still includes the
grades that are NOT null.

This is what I am trying to create.

Entry Book GRADE New Column
a Dante 3 3
b Keats 4
c Yeats 4 4
d Neruda 4
e Hemingway 3 3
f Homer 2 2

Happy New Year HELP!

Thanks!

Where are you doing this?
In a query, include the Entry, Book and Grade fields.
Then add a new column.
NewColumn:IIf(IsNull([Grade]),4,[Grade])

In a report, use an unbound control:
As it's control source, write:
=IIf(IsNull([Grade],4,[Grade])

I left out a parenthesis in the second expression.
It should have read:
=IIf(IsNull([Grade]),4,[Grade])
 
Back
Top