View Full Version : create checkbox in table


finleyl
09-14-2005, 08:30 PM
Hello:
I have a "create table" statement as an action for one of my command buttons (on a form) within my access db. I can create a yesno field with no problem, my question is - how within the same "create table" statement or otherwise with code can I make the yesno field appear as a checkbox?

I can do it within the design view of the table once the table is created, but I want to do it on the fly. Also, I don't want to do this within a form, just on the table itself.

Thanks in advance
finleyl

llkhoutx
09-15-2005, 06:59 PM
Bind that yesno field to a checkbox on a form or report, that is, create a checkbox on a form/report, then set the checkbox's controlsource to the yesno field.

Note that it will have three values, Null, True and False; that Null is not equal to False; if you need to test it, a test for True always works.

finleyl
09-15-2005, 08:44 PM
Bind that yesno field to a checkbox on a form or report, that is, create a checkbox on a form/report, then set the checkbox's controlsource to the yesno field.

Note that it will have three values, Null, True and False; that Null is not equal to False; if you need to test it, a test for True always works.
--------------------------

Sir: Thanks for replying, but as stated in my thread, I do not want to do this in a form, strickly within the creation of a table.

llkhoutx
09-15-2005, 11:53 PM
My mistake on prior post.
I presume that you are using CreateTableDef("NewTable") and tblNew.CreateField to create the various fields in that table.

If you cycle through the field properties of the new table, there's no display property to specify the type of control to associate with a field.

Why do you even care? A Boolean field can have three value; Null, True (-1), or False (0). When a table is opened, that is how it's displayed; Null, -1, or 0.

You say,


I can do it within the design view of the table once the table is created, but I want to do it on the fly.

Precisely how do you so it once the table is created? If that is true, it ought to indicate how to do it "on the fly."

Again, precisely how do you so it once the table is created? I see no table field property which allows this.