Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    1

    Post Unanswered: VBA Help on susbctracting non numeric characters from a field

    Hello,

    I need help on writing VBA code. I have a field in a table that I want to update to have only numeric values. For example, if a field has 1111*22, I want to be able to eliminate only the * and keep all the numeric values. Can someone please guide on how to accomplish this task?

    What I want is to write a function on VBA that I can use in a query to update this field.

    Thanks so much

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Try this:

    Function ReturnNumber(strIn) as Double
    'strIN will be the value you want to convert
    Dim strTemp as string, X as integer
    For X=1 to Len(Strin)
    If IsNumeric(Mid(strIn,X,1)) then
    strTemp=strTemp & mid(strin,X,1)
    end if
    next x
    ReturnNumber=CDbl(strTemp)
    Exit Function
    Inspiration Through Fermentation

Posting Permissions

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