Using a Check Box in SQL

Joe8915

Registered User.
Local time
, 17:31
Joined
Sep 9, 2002
Messages
820
Why is a chk bx is so much differen't in the SQL Server verses a chk bx in Access. I have created a Chx Bx in the SQL Server. Then link the tables and I cannot make it look like a chk bx in my Access side. Being very new in SQL it has something to do in the SQL side.

I have tried a couple of ways.
First I added/Design the table in SQL and the connect to Access.
That didn't work out so then I just reverse the operation Design the table in
Access then link the tables.

Can any one point me in the right direction in what I am doing wrong.

Here are the properties in the SQL side of the Chk Bx

Data Type........bit
Default Value or Binding ............((0))
Condensed Data Type ............bit
Full-test Specification ............No
Identity Specfication .............No
In Sparse ............................ No

On the Access side
its a Yes/No format

:confused:
 
Using the SQL Server Management Studio, what I have found out when adding the filed it shows as a text filed instead of a check box. So I guess my question now is how do I add a check Box field using the SQL Server Management Studio.

Also, do you guys/girls create/design the table in Access first then connect to SQL or create in SQL then link to Access?
 
I've done it both ways. Are you saying when you look in the linked Access table you don't see a checkbox? I think that's normal (was in a table I just looked in). When you're creating a form or report for the user, you'd just make sure to use a checkbox control there. It should work correctly.
 
pbaldy, thanks for the quick reply.
It appears when I add the field in the SQL side its comming out as a Text box, not a check box.
So how do create the fields to make them as check boxes instead text boxes.

When I refresh the link table to Access, they come in as a text box.

I will be gald when I start my classes in SQL.
 
It doesn't matter if it is in the TABLE as a text box. What matters is how you use it on the FORM.
 
thanks for the quick reply SOS.

Thats interesting, ok then in the Access (form) side I want to use it as a Check box.

Man these sound like so dumb questions, sorry
 
Have you tried putting a check box on the form and setting the bound field of the checkbox to be that field?
 
am i right in thinking that SQL stores -1 and 0, not a check box in the table. So yuo get a numeric textbox? - what values will it take?

what are you using as a front end - because if its access, you can bind a checkbox to the boolean field.
 
A check box is a user interface element. There is no such thing in SQL Server because SQL Server is a DBMS and not an application development tool. SQL Server therefore has no feature for creating check boxes.
 
Store the value in the SQL table as a tinyint column and set a check constraint to ensure only 0 and 1 are valid values. ie.

create table mytable
(
mytable_pk int identity(1,1) primary key,
my_checkbox_column tinyint check(my_checkbox_column in (0,1)) not null
)

You can leave the column accepting nulls if you want to allow this, and default the column to 0 using default 0.

Bind the column as normal in the Access form matching the values to the appropriate options.

You can't set tinyint fields to negative numbers, so if you want to use -1 then use a smallint instead.
 

Users who are viewing this thread

Back
Top Bottom