I have a program that creates a SQL statement based upon a treeview list that the user makes. The SQL statement looks like this:

CREATE TABLE Test ( Test ID PRIMARY KEY, Check1 CHAR(255), Check2 MEMO, Check3 INTEGER, Check4 DOUBLE, Check5 DATETIME, Check6 BOOLEAN) VALUES (1, 'DefSML', 'DefLRG', 0, 0.0, '3/7/2008 12:00:00 AM', 'True');

but I continually get a Syntax error - when I check it with a validator it is on the DOUBLE variable. The VB error that i get is System.Data.OleDB.OleDBException: Syntax error in field definition. Which is why I think it is my SQL that is messed up - any help is appreciated. Thanks

I have a program that creates a SQL statement based upon a treeview list that the user makes. The SQL statement looks like this:

CREATE TABLE Test ( Test ID PRIMARY KEY, Check1 CHAR(255), Check2 MEMO, Check3 INTEGER, Check4 DOUBLE, Check5 DATETIME, Check6 BOOLEAN) VALUES (1, 'DefSML', 'DefLRG', 0, 0.0, '3/7/2008 12:00:00 AM', 'True');

but I continually get a Syntax error - when I check it with a validator it is on the DOUBLE variable. The VB error that i get is System.Data.OleDB.OleDBException: Syntax error in field definition. Which is why I think it is my SQL that is messed up - any help is appreciated. Thanks

I dont think you can use the VALUES statement at the same time as CREATE in ACCESS.

  1. Field Name has space (causes problems later)
  2. The int specifier is missing for the Primary Key
  3. Then BOOLEAN specifier not valid - use YESNO

But corrected as...
CREATE TABLE Test (TestID int PRIMARY KEY, Check1 CHAR(255), Check2 MEMO, Check3 INTEGER, Check4 DOUBLE, Check5 DATETIME, Check6 YESNO);

should work, then use an INSERT statement for the first record.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.