Arthur Fuller
fuller.artful at gmail.com
Fri Mar 7 17:40:36 CST 2008
I guess I didn't explain myself well. Sorry, Eric. Following your lead, I created an unbound form and a textbox control on it called txtText. I added a button to save, whose code follows (in addition to a simple function called qq(), to save you the hassle of wrapping the string as you did in your code). I pasted your Dutch string into the textbox on the form, then clicked the Save button. Step through my code and you will see that it performs exactly as advertised, and successfully saves the row to the table. <code> Private Sub Save_btn_Enter() Dim db As DAO.Database Set db = CurrentDb Dim strtest As String 'txtTest = qq(dit moe'st ook "maar" eens getest wor'dn) With Me strtest = Replace(.txtText, Chr(39), Chr(39) & Chr(39)) strtest = Replace(.txtText, Chr(34), Chr(34) & Chr(34)) Debug.Print strtest End With 'your code was: 'db.Execute "insert into TestText (TestText) VALUES ('" & strtest & "')" Dim s As String s = "insert into TestText (TestText) VALUES (" & qq(strtest) & ")" Debug.Print s db.Execute s Set db = Nothing End Sub Function qq(s As String) As String 'this should go in a public module. I just put it here for simplicity qq = Chr(34) & s & Chr(34) End Function </code> hth, Arthur On 3/7/08, Eric Starkenburg <eric.starkenburg at home.nl> wrote: > > Arthur, > > I just used the code underneith to test your theory.... > > The table used has just one field called test in table test. > The form is called form1 and the textbox is called txtTest > Sample text in textbox on a form: dit moe'st ook "maar" eens getest wor'dn > > Code used to save to table on a buttonpress: > Dim db As DAO.Database > Set db = CurrentDb > Dim strtest As String > > strtest = Replace(txtTest, Chr(39), Chr(39) & Chr(39)) > strtest = Replace(txtTest, Chr(34), Chr(34) & Chr(34)) > > db.Execute "insert into test (test) VALUES ('" & strtest & "')" > Set db = Nothing > > Works like a charme without quotes in a sentence but with the sample text > I > get an error: Operator missing blablabla > > What did I do wrong? > >