Escaping unwanted characters, mainly single quotes --replace function and implementation

前端 未结 3 1943
礼貌的吻别
礼貌的吻别 2021-01-18 07:02

I was just testing my database and I realized that I run into problems wherever a text entry in my database contains a \' character (single quote). My solution

3条回答
  •  自闭症患者
    2021-01-18 07:28

    Your query is failing because you have not said where to insert :

    Dim qd As QueryDef
    qr = "INSERT INTO tblExample (AText) VALUES ( [avalue] );"
    
    Set qd = CurrentDB.CreateQueryDef("",qr)
    qd.Parameters("avalue").Value = me.testparam
    qd.Execute dbFailOnError
    

提交回复
热议问题