1 Replies - 2074 Views - Last Post: 18 April 2012 - 01:40 AM

#1 DanDeCoder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 30
  • Joined: 18-October 10

Access 2010 Error when building table using SQL

Posted 18 April 2012 - 01:21 AM

I'm trying to add a table to my database using SQL however I'm getting 'syntax error' on MS Access 2010.
This is the SQL code I have used thus far:

CREATE TABLE Child_Diary
(
Child_ID TEXT(4) CONSTRAINT child_id_no_pk PRIMARY KEY,
Room_ID TEXT(25),
Date TEXT(25),
Time TEXT(25));


However the syntax error is highlighting the 'Date' line. Not sure where I'm going wrong to be honest, I've managed to build all other tables but this one is failing.

I've tried changing the TEXT to INTEGER (just to see if this works) but to no avail.
Can someone shed some light on my error/where I've gone wrong?

Thanks,

Is This A Good Question/Topic? 0
  • +

Replies To: Access 2010 Error when building table using SQL

#2 DanDeCoder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 30
  • Joined: 18-October 10

Re: Access 2010 Error when building table using SQL

Posted 18 April 2012 - 01:40 AM

I think I've sussed it. I've now wrapped the Date and Time in square brackets so it looks like the following:

CREATE TABLE Child_Diary
(
Child_ID TEXT(4) CONSTRAINT child_id_no_pk PRIMARY KEY,
Room_ID TEXT(25),
Date TEXT(25),
Time TEXT(25)); 


So far so good...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1