开发者

Access query to make column that shows checkbox for Yes/No column

开发者 https://www.devze.com 2023-03-21 02:00 出处:网络
I\'ve written a query to create a table in MS-access: CREATE TABLE [customers] ([id] NUMBER, [authorised] YESNO);

I've written a query to create a table in MS-access:

CREATE TABLE [customers]
([id] NUMBER, [authorised] YESNO);

This works fine. However the YES/NO 开发者_运维知识库column displays -1 and 0, when I'd really rather a checkbox.

Is there any way to do this within the query?


This is a known bug: ACC2002: Make-Table Query Does Not Format Yes/No or Bit Fields Correctly. The Knowledge Base article proposes two workarounds, unfortunately none of them one can use in a query.


If this is something you need to do in a production app (i.e., execute DDL to create a new table), I would suggest that you might be better off using a table template, instead. That way, you can set up the template table with all the presentation-level properties set, and then copy it to the final destination.

Of course, now that I've written that, I Googled a bit, and it is, in fact, possible do to this in DAO:

How to Programmatically Specify the Display Control for a Field

I'm not certain, but from the code, it looks like you could run your DDL to create the table, and then run DAO code to alter the display type of the one field, but you'd have to test that to be sure. It might be that you have to create the table entirely in DAO (but it doesn't look like it from the code in the cited article).

0

精彩评论

暂无评论...
验证码 换一张
取 消