Page 1 of 1

Create table Error

PostPosted: Mon Jul 09, 2007 3:35 am
by smartmedia
Hi...

I try to create a new table in Access but i get syntax error and the table are not created... Can you help me...
Here is the code:

dbpCreateAccessDatabase "[PubDir]Favorites.mdb" "Password=code;Encrypted=Yes"

dbpOpenAccessDatabase "Favorites" "[PubDir]favorites.mdb" "code"

dbpCreateTable "Favorites" "Favorites" "id AutoInc Key;Title String(100);Info Memo;Category String(35);SubCategory String(30);Links Memo;Pass String(40);DateInserted DateTime;Size String(8);Status String(1);Username String(20);Lang String(20)"

Re: Create table Error

PostPosted: Mon Jul 09, 2007 6:49 am
by dpayer
smartmedia wrote:Hi...

I try to create a new table in Access but i get syntax error and the table are not created... Can you help me...
Here is the code:



I took your example and changed the name of the table to be different from the name of the database and databaseID and it worked.

That may be an issue.

David P.

PostPosted: Mon Jul 09, 2007 9:00 am
by smartmedia
Hi...

Thanks David but the same error come up to me even when i change the name of database and DatabaseID and Table...

What else can i do...???

PostPosted: Mon Jul 09, 2007 9:48 am
by Gaev
smartmedia:

a) I don't believe that the name of the table is the problem ... I was able to use the favorites name for both the databaseID and tableName.

b) If you remove the id AutoInc Key field definition ... the original error message no longer pops up ... but another one pops up in its place.

c) If you rename the field Size to gkSize ... or something like it ... the second message does not pop upo either.

So perhaps the MSAccess platform ...

i) AutoInc or Key ... or both ... features ?

ii) Size is a Reserved Word and may not be usuable as a field name ?

... see if you can create your original table fields in a mySQL database.

PostPosted: Mon Jul 09, 2007 11:14 am
by smartmedia
Hi...

a) I don't believe that the name of the table is the problem ... I was able to use the favorites name for both the databaseID and tableName.

You right, i be able to create the database with the same ID, file name, table.

b) If you remove the id AutoInc Key field definition ... the original error message no longer pops up ... but another one pops up in its place.

It seems that doesn't accept any key at all, not only the AutoInc Key, i was forced to make the id field as int. (something must be done about this)

c) If you rename the field Size to gkSize ... or something like it ... the second message does not pop upo either.

You right, seems that Size is reserved word. I be happy to know all the reserved words.

Gaev, thanks one more time...

PostPosted: Mon Jul 09, 2007 11:23 am
by Neosoft Support
The unhelpful error message is coming directly from the database engine.
Apparently the word "size" is a special keyword and can't be used as a
table or field name. The web site below shows a list of keywords for each
database type:

http://sqlserver2000.databases.aspfaq.com/what-are-reserved-access-odbc-and-sql-server-keywords.html

It's quite a long list.

The items under both the Jet and Access columns are the ones relevant to MS Access databases.