Iff statement in Tables

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

Guest

I have a table which has a field that carries the Y/N (-1 or 0) value. I am
updating to a table that has the same field but is an text field that is
manually put in as a Y or N. I want to put an expression in the default value
of the fieled which turns the Y/N (-1 or 0) into a Y or N text field.
I have tried to use the below but it is not correct. Can some one give me a
direction. I just want the filed to turn to a Y or N when updated and thought
the below expression would work? Can someone help?

IIf(Nz([TblProductVersionRefill]![Attachments],0)=-1,"Y","N")
 
That is not going to work.
How are you trying to do the update, from a form, a query, etc?

Would it not be better in the long run if you changed the table with the Y/N
to use the -1/0?

It would not be that difficult.
Add a new field to the table that has the Y/N data type.
Run an Update query that reads the old field and makes the new field True if
the old field is Y and False if it is N.
Delete the old field from the table.
Change the name of the new field to what the old field was.
You may have to change some code in your database, but this is a better
approach.
 
Back
Top