Compare 2 text fields and leave one field null if it has the same data as the first field

  • Thread starter Thread starter Barbara Brenner
  • Start date Start date
B

Barbara Brenner

I'm working with a train station index. Here's what I need to do--if the
OrigStation has the same text as the SwitchStation, the text should be
removed from the SwitchStation field so that only stations which use a
Switch Station belonging to someone else should show. In the example, both
the Aberdeen and the Buffalo Barn stations have the same SwitchStation name,
so the SwitchStation column should be blank in those 2 cases. Hope I
explained this okay.

Like this:

OrigStation SwitchStation
Aberdeen
Belt Jct. Mobile, AL
Buffalo Barn, AL
 
Use an update query and in the update to section use an
IIF statement.

For Example:

IIF([OrigStation]=[SwitchStation],NULL,[SwitchStation])

In place of NULL you could use "" but you need to make
sure that in the SwitchStation Field
Allow Zero Length is set to Yes.

GAry
 
Thank you! Worked just fine.

Gary Wheeler said:
Use an update query and in the update to section use an
IIF statement.

For Example:

IIF([OrigStation]=[SwitchStation],NULL,[SwitchStation])

In place of NULL you could use "" but you need to make
sure that in the SwitchStation Field
Allow Zero Length is set to Yes.

GAry
-----Original Message-----
I'm working with a train station index. Here's what I need to do--if the
OrigStation has the same text as the SwitchStation, the text should be
removed from the SwitchStation field so that only stations which use a
Switch Station belonging to someone else should show. In the example, both
the Aberdeen and the Buffalo Barn stations have the same SwitchStation name,
so the SwitchStation column should be blank in those 2 cases. Hope I
explained this okay.

Like this:

OrigStation SwitchStation
Aberdeen
Belt Jct. Mobile, AL
Buffalo Barn, AL


.
 
Back
Top