Query Tools

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prakashsakthivel
    New Member
    • Oct 2007
    • 57

    #31
    Originally posted by vaniKanabathy
    I had try..but Undefine function "REPLACE" in expression error occur. Please Help me.

    Hi Friend.

    Please make sure that whether You have selected latest library or not regarding (DAO or ADO) so that library should support this function.

    Please make sure that which version you are using.


    Regards
    Musai.

    Comment

    • QVeen72
      Recognized Expert Top Contributor
      • Oct 2006
      • 1445

      #32
      Hi,

      Yes, "REPLACE" Function will not work with ADO,

      Use a Combination of Left and MID and INSTR Functions..

      Try This :

      [code=vb]
      conn.Execute "UPDATE Alternator SET " _
      & " EversparkNo1 = Left(EversparkN o1,Val(InStr(Ev ersparkNo1,'-')-1)) " _
      & " Mid(EversparkNo 1,Val(InStr(Eve rsparkNo1,'-')+1)) " _
      & " Where EversparkNo1 Like '%-%' "
      [/code]


      Note: Only First Found "-" is replaced.
      If you have multiple occurance of the same character,
      say 3 times , then you need to run the same query thrice...

      Regards
      Veena

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #33
        Hi,

        Sorry, "&" was removed.. Try this one:

        [code=vb]
        conn.Execute "UPDATE Alternator SET " _
        & " EversparkNo1 = Left(EversparkN o1,Val(InStr(Ev ersparkNo1,'-')-1)) " _
        & " & Mid(EversparkNo 1,Val(InStr(Eve rsparkNo1,'-')+1)) " _
        & " Where EversparkNo1 Like '%-%' "
        [/code]

        Regards
        Veena

        Comment

        Working...