Results 1 to 3 of 3
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    QUERY ERROR WITH ''' (6.0)

    I use this query to insert data in mdb....
    but prob sisntiax when the var contain ' in this case var NUM_PRATICA=d'alterio...
    have used a replace method ..."'","" but dalterio not is the same d'alterio
    The filed as text

    SQL = "INSERT INTO SOSPESI (PROVA01,PROVA02,PROVA03,PROVA04,PROVA05,PROVA06,P ROVA07,PROVA08,PROVA09,PROVA10,PROVA11,PROVA12,PRO VA13,PROVA14,PROVA15,PROVA16)VALUES('" & CStr(SPORT_1) & "','" & PROG & "','" & TIP & "','" & TIP_SOSP & "','" & DESCR & "','" & CDate(DATA_CONT) & "','" & Format((DIV), "#000") & "', '" & CAUSALE & "','" & IMPORTO & "','" & Format(CDate(DATA_SCAD), "DD/MM/YYYY") & "',' & BENF_DEB & ','" & Format(SPORT, "#0000") & "','" & ST & "','" & Replace(NUM_PRATICA, "'", "") & "','" & Format(CDate(DATA_INQ), "DD/MM/YYYY") & "','" & Format(CDate(Now), "DD/MM/YYYY") & "')"
    DB2.Execute (SQL)

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: QUERY ERROR WITH ''' (6.0)

    Hunch: Maybe you need to replace the single ' with two ' so
    d ' alterio
    becomes
    d ' ' alterio (I inserted spaces to ensure you see what I mean)
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: QUERY ERROR WITH ''' (6.0)

    TKS... for the explain

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •