Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert issue

Status
Not open for further replies.

NiceArms

Programmer
May 21, 2009
105
GB
Hi All,

The following code is doing my "Nut!" what is wrong with it?

When I run the module I get an error advising that the SQL statement is incorrect.


SqlInst = "INSERT INTO Result (Date) VALUES '01/01/1900'"
Debug.Print SqlInst
DB.Execute SqlInst

/Nice
 
Date may be causing a problem as it's a reserved word.

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Try with jet date dilimiters

Code:
"INSERT INTO Result ([Date]) VALUES #01/01/1900#"

BTW: Date is a reserved word not a good idea to use
 
Nope, I changed the DATE to a word "Apples" and I still get the error.

/Nice
 
Also tried:

"INSERT INTO Result ([Date]) VALUES #01/01/1900#"

Still no joy
 
SqlInst = "INSERT INTO Result ([Date]) VALUES (#01/01/1900#)"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
SqlInst = "INSERT INTO Result ([Date]) VALUES (#01/01/1900#)"

does not work either
 
does not work either
Any chance you could help us to help you ?
What happens ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Not wise to use a keyword for a field name. ie date

Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
Also, maybe worth checking if the field is set up as a date, numeric or text field?

Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
When I run the module I get an error
How are you running the module?
You should be calling a public function in the module.
Do NOT use the same name for both module and function.
If you post your entire code, someone here will spot the error.


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top