Need replace chr in textfield ?

Many times are necesary check de info text to be INSERT or UPDATE, example… in the sql string the chr(39) ’ are used to separe text, example… (‘01’,‘my text’) … in this case ’ are prohibited into the text example (‘01’,’ Mac’ Millan’) because generated error…

to repare this, use this function to revise all your textfield

example ty try

call Fn_ProtectedChar()

and the function is

Sub Fn_ProtectedChar()
  ' ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
  ' Consultora Informtica Dieminger -  GreenLine Software
  ' Marambio 551 1P - Ober (3360) - ConsultoraDieminger@hotmail.com
  ' Ruben Anibal Dieminger ( Informtico ) Matr.Prof 036
  ' ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** 
  ' Modulo: Fn_ProtectedChar
   ' Accin: Replace prohibited chr(39) with blank space chr(32) in all textfield for INSERT or UPDATE
    ' ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
  
  dim myTmpText as string

  ' ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
  ' Check all textfield from ( non pemited char) ' = chr(39)
  ' ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
  for i as integer = 0 to self.ControlCount - 1
    
    dim myControl as Control = self.Control(i)
    ' ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
    ' Only textfield are check
    ' ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- 
    if myControl IsA TextField then
      
      myTmpText = Textfield(myControl).Text
      if instr(myTmpText,chr(39)) <> 0 then
        '  replace prohibited char(39) with 1 space chr(32)
        Textfield(myControl).Text  = replaceall(myTmpText,chr(39),chr(32))
      end if
      
    end if  
    
  next
End Sub

You can keep the ’ by “double quoting” e.g.

Replaceall(myTmpText, “’”, “’’”)

But you are much better to use prepared SQL Statements which will fix this and also prevent SQL Injections.