How to show checkbox in combobox?

W

WDSnews

The parent table has a boolean field. If I use it in the combobox of a
child form, the display shows 'Yes' or 'No' rather than the checkbox I want
to see.
 
L

Lynn Trapp

Regular combo boxes can only display the actual value stored in your row
source, not the checkbox display. If you have A2007, you can use a
multi-valued combobox and it will show checkboxes.
 
D

David W. Fenton

I don't think there's any way you'll show check boxes as such in a
combo box. The nearest you could get would be to use the usual
method for simulating check boxes of a size/format different from
the default in a form by setting the FontName property of the
combo box to Wingdings and in its RowSource use a computed column
to return the relevant character for a tick, e.g.

SELECT IIf([MyBooleanField],Chr(252),"")
FROM MyTable;

That will give you a tick for each True and a blank for each
False, but you won't get a box around them as you can to simulate
a single check box in a form or report by using a text box based
on the computed column.

I do something similar to Ken's, but not using a special font. I
simply do:

SELECT IIf(MyBooleandField," x", Null)
From MyTable;

Then number of spaces before the "x" is determined by eye according
to the width of the boolean column in the combo box.

For listboxes, Stephen Lebans has a solution:

http://www.lebans.com/List_Combo.htm

The checkbox listbox solution is under the FieldList link. I've
downloaded it and looked at the demo but never actually ended up
using it in any of my apps.

It doesn't work with combo boxes, though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top