By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,509 Members | 2,201 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,509 IT Pros & Developers. It's quick & easy.

Displaying Boolean Fields as Check or Empty Boxes

P: 2
To display boolean fields in any query as checked or empty boxes, try:
Expand|Select|Wrap|Line Numbers
  1. IIf([BooleanFieldName],ChrW(9745),ChrW(9744))
This works using Arial and should also work with similar fonts. The field will not be modifiable, but will display reasonably close to actually using a continuous form.
Jan 23 '18 #1
Share this Question
Share on Google+
8 Replies


gnawoncents
100+
P: 212
Don,

Welcome to Bytes! Nice tidbit, but you probably want to put it in the Articles section.
Jan 23 '18 #2

NeoPa
Expert Mod 15k+
P: 31,186
GnawOnCents:
Nice tidbit, but you probably want to put it in the Articles section.
Actually no. Articles have to have much more to them than this. Unfortunately I can't find the thread that explains what is expected but there should be one somewhere in the FAQ.
Jan 23 '18 #3

gnawoncents
100+
P: 212
NeoPa--thank you for the clarification.

Below is the link to the information on submitting an article. Not a thread, but guidelines from the site at any rate.

https://bytes.com/faq.php?faq=article_guidelines
Jan 23 '18 #4

P: 2
I think it is just a tid-bit, rather than an article. I had occasion to figure this out myself recently, and had searched for ideas. I was weary of all of the replies that it could not be done, a form should be used, or other lectures on "good" programming practice. Once I stumbled upon exactly how it COULD be done, I wanted to spread it around.
Jan 23 '18 #5

NeoPa
Expert Mod 15k+
P: 31,186
Perfectly fine Don. The little side-discussion proved helpful even if not directly pertinent to your tidbit.

We all benefitted :-)
Jan 24 '18 #6

twinnyfo
Expert Mod 2.5K+
P: 3,065
Hey Don,

Neat little trick! Another side question would be, how are you using this tidbit? Obviously, if you were using a Form or Report, you would simply include a CheckBox control. This is not to nit-pick your tidbit, but for me, understanding how this trick is used might give me different options for my own applications.

Thanks for the submission!
Jan 24 '18 #7

NeoPa
Expert Mod 15k+
P: 31,186
Hi Twinny.

Let me answer that if I may, as it raises a very important point that should not be overlooked.

Like with most things in Access, and computing in general too, it's important to differentiate between data for working on and data for display. This is an example of formatting the result for human consumption. Thus, it is no longer very useful to use as data.

So, use this to show the query results directly, so a human can interpret it.

Do NOT use this as a query to be consumed by another query or any other type of Access object such as a Form or Report.

This is a very important point and is similar to the numerous problems people come across when trying to use a value that's previously been formatted for viewing purposes. One is a numeric/date/boolean value. The other is a text string that represents that value in a human viewable format. Not remotely the same things.
Jan 25 '18 #8

NeoPa
Expert Mod 15k+
P: 31,186
It may also be helpful to know that fields in Access QueryDefs have their own Format properties. So, setting this property to True/False, or even Yes/No, is a far more sensible approach if you only want to see this as such and an actual check is not absolutely required.

That way the value isn't changed and can still be consumed reliably by other objects, while still showing clearly that the value is a boolean one. The Format property handles displaying the value in a way designed for humans without changing the value of the field itself.

I would advise this approach strongly over the other unless a check is absolutely necessary, as changing the value is a problem waiting to happen unless you are very careful with it. Even then, some other poor sucker may be left with the problem to resolve further down the line if it's copied or inherited. It's a shame Access QueryDefs don't allow the addition of comments that could be used to document the undesirable situation should it ever be used.
Jan 25 '18 #9

Post your reply

Sign in to post your reply or Sign up for a free account.