where do I set the datatype for a field

V

Vinaren

Guess this is easy but I just can't find where to set the datatype for a
query field
I have a table with three fields. The datatype for the three fields are yes/no
I made a query that combines the three different fields into one.

The query represented as sql is:
SELECT [a] Or Or [c] AS testar
FROM table1;

And it works as it should but the result is a table with 0 and -1
I don’t want that, I want it to be shown as table with checkboxes.
Would greatly appreciate if someone could explain to me how to make that
happen.
 
J

John W. Vinson

Guess this is easy but I just can't find where to set the datatype for a
query field
I have a table with three fields. The datatype for the three fields are yes/no
I made a query that combines the three different fields into one.

The query represented as sql is:
SELECT [a] Or Or [c] AS testar
FROM table1;

And it works as it should but the result is a table with 0 and -1
I don’t want that, I want it to be shown as table with checkboxes.
Would greatly appreciate if someone could explain to me how to make that
happen.


True is in fact stored as -1, False as 0. If you create a Form with a checkbox
control bound to [testar] you'll get the desired appearance. Table and query
datasheets are not designed for data presentation - forms are the appropriate
tool. There ia no "checkbox" datatype; the data is Yes/No, and a checkbox is
just a tool to display that data.

John W. Vinson [MVP]
 
M

Marshall Barton

Vinaren said:
Guess this is easy but I just can't find where to set the datatype for a
query field
I have a table with three fields. The datatype for the three fields are yes/no
I made a query that combines the three different fields into one.

The query represented as sql is:
SELECT [a] Or Or [c] AS testar
FROM table1;

And it works as it should but the result is a table with 0 and -1
I don’t want that, I want it to be shown as table with checkboxes.
Would greatly appreciate if someone could explain to me how to make that
happen.



That's not a data type issue, it's a formatting issue.

Aside from displaying a query's datasheet to users being a
poor practice, you can set the query field's display control
to check box.
 
J

John Spencer

Marshall,

I can see where setting the property of Display Control for a field in a
table will show a checkbox when you use the field in a query.

I don't see where you can set a calculated field in a query to show a
checkbox. What am I missing?

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Marshall Barton said:
Vinaren said:
Guess this is easy but I just can't find where to set the datatype for a
query field
I have a table with three fields. The datatype for the three fields are
yes/no
I made a query that combines the three different fields into one.

The query represented as sql is:
SELECT [a] Or Or [c] AS testar
FROM table1;

And it works as it should but the result is a table with 0 and -1
I don't want that, I want it to be shown as table with checkboxes.
Would greatly appreciate if someone could explain to me how to make that
happen.



That's not a data type issue, it's a formatting issue.

Aside from displaying a query's datasheet to users being a
poor practice, you can set the query field's display control
to check box.
 
M

Marshall Barton

John said:
Marshall,

I can see where setting the property of Display Control for a field in a
table will show a checkbox when you use the field in a query.

I don't see where you can set a calculated field in a query to show a
checkbox. What am I missing?


Well, John, something is missing, but I doubt that it's you.

I don't remember exactly what I tried yesterday, but today I
am getting all kinds of inconsistent behavior on the Lookup
tab. Sometimes I can't get a query to allow any display
control on any field until after I switch to datasheet and
back to design view. Other times I can select
text/combo/list box on some fields, but not on others. In
no case today can I get a display control of check box on
any field of any type, calculated or not.

We should write off my answer yesterday as a figment of my
imagination and stick with the standard solution of using a
form to display the data.
 

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