Reversing the Values of Tickboxes

M_S_Jones

Registered User.
Local time
Today, 00:25
Joined
Jan 4, 2008
Messages
119
Good afternoon,

I'm looking for a way to reverse all of the values in a yes/no field in a table. That is that I wish for all 0s to become -1s and all -1s to become 0s. I've just checked the data and every record falls into one of those categories, none are null. I tried to build an update query to change every 0 to a -1 and every -1 to a 0, but unsurprisingly it didn't work. Any ideas? It only needs to be run once, so even a ridiculously slow solution would be appreciated!

Thanks,

Matthew
 
Ensure you back the data up irst, but would this work...

iif([yourfield]=-1,0,-1)
 
just do an update query

if the field is called myflag

then set the new value to be

not [myflag]

thats all it needs

-------
it really is better to think of booleans in terms of true/false rather than numeric values
 
I'd use NOT([myYN]) also since it's a boolean, but just for fun, here's a formula:
-([myYN]+1)

Chris
 
Thank you both for the replies. Using test data, I tried them both. Gemma, your code set them all to be No (0), but Kiwiman, yours worked perfectly. Thank you both again.

Matthew
 
Thank you both for the replies. Using test data, I tried them both. Gemma, your code set them all to be No (0), but Kiwiman, yours worked perfectly. Thank you both again.

Matthew

Oh sorry about that Gemma, I just tried it again and it worked. Sorry, I must have mistyped something first time!

Thank you all for your help!

Matthew
 

Users who are viewing this thread

Back
Top Bottom