How to add date in access database

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

I am trying this:
SQL = "INSERT INTO GradeList (Date) Values(#01-01-2007#)"

I get message "Syntax error in Insert statement".

How to add date field in access database?
 
By enclosing Date in square brackets or renaming the column not using a
reserved word.

SQL = "INSERT INTO GradeList ([Date]) Values(#01-01-2007#)"

SQL = "INSERT INTO GradeList (the_Date) Values(#01-01-2007#)"

Bob Lehmann
 
¤ I am trying this:
¤ SQL = "INSERT INTO GradeList (Date) Values(#01-01-2007#)"
¤
¤ I get message "Syntax error in Insert statement".
¤
¤ How to add date field in access database?

The keyword Date is reserved (it's a function). Use a different name for your column.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
SQL = "INSERT INTO GradeList (Date) Values(#01-01-2007#)"

I get message "Syntax error in Insert statement".

Yes - that's because in Access the word 'Date' is what is known as a
reserved word - in this particular case, because Date is an Access
function...
How to add date field in access database?

The "correct" way is, to rename the column to something which isn't a
reserved word...

The "workaround" is to enclose the reserved word in square brackets...

I'd advise you to choose the first option, unless you are unable to change
the database schema...
 
Hi,

First of all there is no need to post to so many groups at the same time.

Regarding your problem, Date is a reserved word, you have to refer to it as
[Date]
Additionally I would suggest you to use parametered queries.
 
Ignacio

I suggest you take your C# _CRAP_ and shove it up your ass.

If I want to get your advice, I'll call the cSharp FAGS i promise

your langauge doesn't EXIST





Hi,

First of all there is no need to post to so many groups at the same time.

Regarding your problem, Date is a reserved word, you have to refer to it as
[Date]
Additionally I would suggest you to use parametered queries.


I am trying this:
SQL = "INSERT INTO GradeList (Date) Values(#01-01-2007#)"
I get message "Syntax error in Insert statement".
How to add date field in access database?
 
Back
Top