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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax error in query 1

Status
Not open for further replies.

fordtran

Programmer
Jun 15, 2005
101
ZA
I have a syntax error in this query, but cannot find it. Can somebody help ?

S$ = "INSERT INTO comments (comment, date) VALUES (" & Chr(39) & txtComment.Text & Chr(39) & ", #" & Today & "# )"

Thanks

fordtran
 
Code:
S$ = "INSERT INTO comments (comment, [date]) VALUES ('" & Replace(txtComment.Text, "'", "''") & "', #" & Today & "# )"

BTW, what is Today ?
You meant Date() ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV
I am not sure of your recommended syntax

Is it ... values ( " ' " & txtcomment.text & " ' , #" & date() & "#)"



fordtran
 
In VBA:
Code:
S$ = "INSERT INTO comments (comment,[date]) VALUES ('" & Replace(txtComment.Text, "'", "''") & "',#" & Format(Date, "yyyy-mm-dd") & "#)"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top