Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Yes/No Fields

Status
Not open for further replies.

critzos

Programmer
Mar 21, 2002
12
0
0
US
I have a table (TBL_OTHER)that has numerous Yes/No fields. About 20 or so. Can I create a table (TBL_YESNO) that has a primary key and one other field, enter two records in that TBL_YESNO (yes and no), and then relate it with a foreign key to each field in the other table (TBL_OTHER)? Or is there a better way? Thanks for your responses.
 
Hi,

what if you use a boolean type? True and false instead of yes and no.

Branko
 
But then how do I have yes/no appear as opposed to the 1/0 that the boolean puts in the field??? Thanks for your response!
 
That is up to the front-end.
I don't know how you will input the data and display it.
Can you give me some more information on that?

Branko
 
As is evident from my questions, I am a novice (at best!). I plan on using Access for the front end. Can that be programmed to return a Yes/No value based on what's in the Binary field? If so, is it difficult to do? Again, thanks for your input and PATIENCE!!!
 
There is no boolean data type, per se, in SQL Server. You can use the Bit data type which can contain the value 0, 1 or NULL.

I would not create the TBL_YESNO table.

Write a function in Access that converts the data in a field to Yes/No on the screen and another function that converts the Yes/No back to whatever data type is in your main table.
 
Hi,

I am back. Now at a computer where I have SQL.
Access can work with the bit field of SQL. In a very simple test I created a table in SQL with a bit field. (I would not allow null values, it's yes or no)1 for yes, 0 for no.
Then I created a linked table from Access using ODBC. I used the wizard to make a -standard- form from this table. (Access changes 1 to -1 as true for some funny reason.) You can -in design view- add for instance a radiobutton or checkbox. Choose properties and set on the Data tab the Control Source to your yes/no column. Ready! You can set or clear the bit with the control.
There are ofcourse many other ways.
btw. Access has his own yes/no or on/off type.
Hope this helps you. Feel free to ask more if needed

Branko
 
Thank you VERY much! I will try it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top