|
-
Jan 11th, 2007, 10:29 AM
#1
Thread Starter
Fanatic Member
Yes/No field in Access SQL create table statement
Hello all,
Anyone know the syntax to create a yes/no field in a SQL create table statement (Not using the designer, SQL only) in ms access?
ie something like:
CREATE TABLE test (FIELD1 TEXT(35), FIELD2 YES/NO))
The text field is correct, but I don't know the datatype to create the yes/field. FYI, I've tried boolean and bit; boolean doesn't work, and bit creates the field, but as a text box instead of a checkbox. This is in MS Access
Thanks in advance!
Strick
-
Jan 11th, 2007, 12:01 PM
#2
Frenzied Member
Re: Yes/No field in Access SQL create table statement
Use Boolean for the data type. I don't know why Access calls it Yes/No in table design, but the data type is boolean.
Tengo mas preguntas que contestas
-
Jan 11th, 2007, 03:47 PM
#3
Re: Yes/No field in Access SQL create table statement
Because you can set it to show (in Access) Yes/No, True/False or On/Off - all of which are ways to represent a boolean value.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Jan 11th, 2007, 07:17 PM
#4
Frenzied Member
Re: Yes/No field in Access SQL create table statement
I know, but calling it Yes/No is a poor idea and leads to confusion like this. You could also use numeric values, -1 & 0 (I think, never keep them straight).
The only reason I can think why MS did this is to design Access for dopes who can't tell between "Yes" and "True"
Me: Jessica Alba, would you like to spend the night with me?
Jessica: Yes
Me:Jessica Alba, would you like to spend the night with me?
Jessica: True
I've never asked Jessica Alba this question and gotten a different answer. So there.
Tengo mas preguntas que contestas
-
Jan 12th, 2007, 06:23 AM
#5
Re: Yes/No field in Access SQL create table statement
you can use something like this
Code:
CREATE TABLE test (FIELD1 TEXT(35), FIELD2 BIT))
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
Jan 12th, 2007, 09:08 AM
#6
Thread Starter
Fanatic Member
Re: Yes/No field in Access SQL create table statement
Thanks guys,
I've already tried it as bit. Problem is, it will create the field but it will create it as a textbox instead of a checkbox. I needed it created as a check box.
Also, boolean doesn't work.
Thanks for all your help.
Strick
Last edited by stricknyn; Jan 12th, 2007 at 10:31 AM.
-
Jan 12th, 2007, 10:11 AM
#7
Frenzied Member
Re: Yes/No field in Access SQL create table statement
Huh. Apparently Access calls it YesNo, no slash. To see the table you'll have to refresh the database window. This might help.
Tengo mas preguntas que contestas
-
Jan 12th, 2007, 10:42 AM
#8
Thread Starter
Fanatic Member
Re: Yes/No field in Access SQL create table statement
Thanks, I'll try this out
Strick
-
Jan 12th, 2007, 12:47 PM
#9
Re: Yes/No field in Access SQL create table statement
 Originally Posted by salvelinus
I know, but calling it Yes/No is a poor idea and leads to confusion like this. You could also use numeric values, -1 & 0 (I think, never keep them straight).
The only reason I can think why MS did this is to design Access for dopes who can't tell between "Yes" and "True"
Designed by the same guy who invented the ADO Data Control, so that if you can drag a control to a form you can be a "database front end developer".
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|