问题描述:

I got this error everytime I try to save the text in this field to the database. The code is this:

Dim strInsert As String

strInsert = "INSERT INTO Dbase (EB3_30) VALUES ('" & Me.EB3_30 & "')"

CurrentDb.Execute strInsert

The debugger stops at the last line and I get this error (I'm going to traduce it because it's in spanish):

run time error '3075':

Syntax Error (Missing Operator) in query expression "value of EB3_30"

The value of EB3_30 is a string of aproximate length 250. As it's in spanish some letters have accents. I also use dots, apostrophes and slashes. Maybe some of this characters cause problems? Any ideas?

网友答案:

Apostrophes probably cause problem. Try this:

strInsert = "INSERT INTO Dbase (EB3_30) VALUES ('" & Replace(Me.EB3_30, "'", "''") & "')"
相关阅读:
Top