|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to add date in access databaseI 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 Show quote "Tony" <tonya***@hotmail.com> wrote in message news:es1avr$qor$1@magcargo.vodatel.hr... > 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? > > > > On Tue, 27 Feb 2007 14:30:50 +0100, "Tony" <tonya***@hotmail.com> wrote: ¤ 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) "Tony" <tonya***@hotmail.com> wrote in message Yes - that's because in Access the word 'Date' is what is known as a news:es1avr$qor$1@magcargo.vodatel.hr... > SQL = "INSERT INTO GradeList (Date) Values(#01-01-2007#)" > > I get message "Syntax error in Insert statement". 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. Show quote "Tony" <tonya***@hotmail.com> wrote in message news:es1avr$qor$1@magcargo.vodatel.hr... >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? > > > > |
|||||||||||||||||||||||