Automatic removes data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jacky11

    Automatic removes data

    I want to have a query that removes all dashes for a field
    named "item name"
    But I don't want to delete the dashes from the table.
    What do I have to write in the query?
    Thanks
  • Fredg

    #2
    Re: Automatic removes data

    Since you haven't mentioned which version of Access you're using, I'll
    assume the latest.

    NoHyphens:Repla ce([ItemName],"-","")

    --
    Fred

    Please reply only to this newsgroup.
    I do not reply to personal e-mail.


    "Jacky11" <myhnews@hotmai l.com> wrote in message
    news:4632a266.0 309150606.2b6a0 d74@posting.goo gle.com...[color=blue]
    > I want to have a query that removes all dashes for a field
    > named "item name"
    > But I don't want to delete the dashes from the table.
    > What do I have to write in the query?
    > Thanks[/color]


    Comment

    • Jacky11

      #3
      Re: Automatic removes data

      Thanks for your response
      I have Access 2000
      The only thing I want to remove is the –
      The above code didn't work for me.



      "Fredg" <fgutkind@att.n et> wrote in message news:<p%j9b.139 782$0v4.1029903 0@bgtnsc04-news.ops.worldn et.att.net>...[color=blue]
      > Since you haven't mentioned which version of Access you're using, I'll
      > assume the latest.
      >
      > NoHyphens:Repla ce([ItemName],"-","")
      >
      > --
      > Fred
      >
      > Please reply only to this newsgroup.
      > I do not reply to personal e-mail.
      >[/color]

      Comment

      • Fredg

        #4
        Re: Automatic removes data

        Jacky,
        This will work in all versions of Access.

        Copy and Paste the following function into a Module.

        Function RemoveChar(Fiel dIn As String) As String

        Dim intX As Integer
        Dim intY As Integer
        intY = 1
        Dim NewString As String

        intX = InStr(1, FieldIn, "-")
        Do While intX <> 0
        NewString = NewString & Mid(FieldIn, intY, intX - intY)
        intY = intX + 1
        intX = InStr(intY, FieldIn, "-")
        Loop
        NewString = NewString & Mid(FieldIn, intY, Len(FieldIn) - intY + 1)
        RemoveChar = NewString

        End Function
        ======

        You can call it from a query:
        NoHyphens:Remov eChar([ItemName])

        --
        Fred

        Please reply only to this newsgroup.
        I do not reply to personal e-mail.


        "Jacky11" <myhnews@hotmai l.com> wrote in message
        news:4632a266.0 309151139.5811f 205@posting.goo gle.com...[color=blue]
        > Thanks for your response
        > I have Access 2000
        > The only thing I want to remove is the -
        > The above code didn't work for me.
        >
        >
        >
        > "Fredg" <fgutkind@att.n et> wrote in message[/color]
        news:<p%j9b.139 782$0v4.1029903 0@bgtnsc04-news.ops.worldn et.att.net>...[color=blue][color=green]
        > > Since you haven't mentioned which version of Access you're using, I'll
        > > assume the latest.
        > >
        > > NoHyphens:Repla ce([ItemName],"-","")
        > >
        > > --
        > > Fred
        > >
        > > Please reply only to this newsgroup.
        > > I do not reply to personal e-mail.
        > >[/color][/color]


        Comment

        Working...