View Single Post
  #1  
Old August 10th, 2004, 08:27 PM
Jeff Conrad
external usenet poster
 
Posts: n/a
Default Q1: How to create a boolean table field in code?

Hi,

Using Access 97 at the moment, but this project will also be compatible for 2000+.

I've completed making another Access Add-In and everything works fine, but there are two tiny issues
I'd like a little feedback on. Second issue will be in another thread.

I'm creating a table in code, but I cannot seem to create a Boolean field using the "Create Table"
statement. My workaround is to make all the fields except that one on the first pass. I then use a
second function to create a TableDef on the new table and use a CreateField statement to make the
Boolean field. This works fine, but what am I missing about using the Create Table statement?

As a test try this code from the immediate window:

Public Function funcTest()

Dim db As DAO.Database

Set db = CurrentDb

db.Execute "CREATE TABLE tblTest " _
& "(FirstField TEXT, SecondField dbBoolean);"

Set db = Nothing

End Function

I get a syntax error. Instead of dbBoolean I've also tried:
Boolean, Yes/No, True/False, -1/0, Up/Down, etc, but nothing seems to work.

Is it not possible to make a Boolean field using the Create Table statement?

Thanks for any help,

--
Jeff Conrad
Access Junkie
Bend, Oregon
*282 Days Left*