简体   繁体   中英

Reverse MS-Access Format Function

I have a field within an Access 2007 database which contains either a 0 or a 1 .

When displaying a view, I need to format the field as Yes/No .

My issue is that I can't use FORMAT(Field,"Yes/No") as the 1 and 0 are the wrong way round ie:

0 = No 1 = Yes is how the format function works.

1 = No 0 = Yes is how my data is formatted.

Is there anyway to reserve or manipulate the FORMAT function in a way that when a query is run, the query will display my Yes/No the correct way round?

FORMAT(ABS(Field-1), "Yes/No")

这是有效的,因为ABS(1-1)= 0且ABS(0-1)=1。换句话说,您的0-> 1和1-> 0,因此它将数字更改为具有“正确”值(到目前为止(对于MS-Access而言)),然后再使用格式功能。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM