trying to create table in Access2007.

CREATE TABLE user
(id Text(8),
last Text(25),
first Text(20),
class Text(10),
dob DateTime);

but table is not being created.

ERROR:
query must have at least one destination field.

Recommended Answers

All 2 Replies

this is 2nd query to give it primarykey:

CREATE INDEX PrimaryKey
ON user(id) WITH PRIMARY

You may wish to consider using different column names, because I believe at least two of your choices are reserved words in the MSAccess SQL dialect.

As an alternative, you should enclose every column name (and probably the table name) in square brackets. This will force the Jet engine to interpret them as tokens rather than reserved words.

So, your query would look like this:

CREATE TABLE [user]
([id] Text(8),
[last] Text(25),
[first] Text(20),
[class] Text(10),
[dob] DateTime)

Hope that helps. Good luck!

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.