I need hep Adding a boolean field using CREATE TABLE in VBA

  • Thread starter Thread starter GitarJake
  • Start date Start date
G

GitarJake

dbs.Execute "CREATE TABLE [" & Me.txtSongbookName & "] " _
& "(SongTitle CHAR (50), SongOrder INTEGER, SongLyrics MEMO, " _
& "SongChords_A MEMO, ASelect Yes/No)"


Hello all,

Where it says "Yes/No" above I have tried "Boolean", "True/False", "On/Off"
and even "MakeADernedYes/NoFieldYouSnippityTwitOfAProgram"!

How do I add a yes/no field to a table using CREATE TABLE in VBA?

TIA

Jake
 
"GitarJake" said:
dbs.Execute "CREATE TABLE [" & Me.txtSongbookName & "] " _
& "(SongTitle CHAR (50), SongOrder INTEGER, SongLyrics MEMO, " _
& "SongChords_A MEMO, ASelect Yes/No)"


Hello all,

Where it says "Yes/No" above I have tried "Boolean", "True/False", "On/Off"
and even "MakeADernedYes/NoFieldYouSnippityTwitOfAProgram"!

How do I add a yes/no field to a table using CREATE TABLE in VBA?

TIA

Jake

Jake

Accorsing to the Access Help File, you can use BIT, LOGICAL, LOGICAL1 or YESNO
to create a boolean field that can store boolean values. Note that the data
will be displayed as 0 or -1, rather than Yes/No or True/False when created by
this method.
 
Hi Jon,

When I use: BIT, LOGICAL, LOGICAL1 or YESNO in place of Yes/No in my
statement, I get a "Syntax Error In Create Table Statement"

Am I spelling something wrong?

TIA


Jake



JSand42737 said:
"GitarJake" said:
dbs.Execute "CREATE TABLE [" & Me.txtSongbookName & "] " _
& "(SongTitle CHAR (50), SongOrder INTEGER, SongLyrics MEMO, " _
& "SongChords_A MEMO, ASelect Yes/No)"


Hello all,

Where it says "Yes/No" above I have tried "Boolean", "True/False", "On/Off"
and even "MakeADernedYes/NoFieldYouSnippityTwitOfAProgram"!

How do I add a yes/no field to a table using CREATE TABLE in VBA?

TIA

Jake

Jake

Accorsing to the Access Help File, you can use BIT, LOGICAL, LOGICAL1 or YESNO
to create a boolean field that can store boolean values. Note that the data
will be displayed as 0 or -1, rather than Yes/No or True/False when created by
this method.

--

Jon

www.applecore99.com - Access Tips and Tricks
 
"GitarJake" said:
Hi Jon,

When I use: BIT, LOGICAL, LOGICAL1 or YESNO in place of Yes/No in my
statement, I get a "Syntax Error In Create Table Statement"

Am I spelling something wrong?

TIA


Jake



JSand42737 said:
"GitarJake" said:
dbs.Execute "CREATE TABLE [" & Me.txtSongbookName & "] " _
& "(SongTitle CHAR (50), SongOrder INTEGER, SongLyrics MEMO, " _
& "SongChords_A MEMO, ASelect Yes/No)"


Hello all,

Where it says "Yes/No" above I have tried "Boolean", "True/False", "On/Off"
and even "MakeADernedYes/NoFieldYouSnippityTwitOfAProgram"!

How do I add a yes/no field to a table using CREATE TABLE in VBA?

TIA

Jake

Jake

Accorsing to the Access Help File, you can use BIT, LOGICAL, LOGICAL1 or YESNO
to create a boolean field that can store boolean values. Note that the data
will be displayed as 0 or -1, rather than Yes/No or True/False when created by
this method.

Jake

I just ran the code with a fixed table name, and it works OK:

dbs.Execute "CREATE TABLE [Test5] " _
& "(SongTitle CHAR (50), SongOrder INTEGER, SongLyrics MEMO, " _
& "SongChords_A MEMO, ASelect YESNO)"

It might be the value of txtSongbookName. What I do when working with SQL
strings is to use a string variable to hold the SQL in, to make it easier to
Debug.Print, and then copy from the immediate window to something like Notepad
to examine:

Dim strSQL As String
strSQL="CREATE TABLE [" & txtSongbookName & "] " _
& "(SongTitle CHAR (50), SongOrder INTEGER, SongLyrics MEMO, " _
& "SongChords_A MEMO, ASelect YESNO)"
Debug.Print strSQL
dbs.Execute strSQL
 
GitarJake said:
dbs.Execute "CREATE TABLE [" & Me.txtSongbookName & "] " _
& "(SongTitle CHAR (50), SongOrder INTEGER, SongLyrics MEMO,
" _ & "SongChords_A MEMO, ASelect Yes/No)"


Hello all,

Where it says "Yes/No" above I have tried "Boolean", "True/False",
"On/Off" and even "MakeADernedYes/NoFieldYouSnippityTwitOfAProgram"!
LOL

How do I add a yes/no field to a table using CREATE TABLE in VBA?

Use BIT or YESNO as the field type.
 
Back
Top