Solved

Access 2003 Query Is Finding Fields With Non-Alphanumeric Data

Posted on 2013-01-22
4
357 Views
Last Modified: 2013-01-23
I can't seem to find an Access 2003  function that will remove all non-alphanumeric data from a field. My query is unable to summarize data because fields that contain identical data are not being properly Grouped because one of them contains what looks like boxes/squares at the end/far right of the field; I assume some type of carriage return or other non-alphanumeric placeholder.

I've already tried using the Trim function but it fails to eliminate the oddball data.

I should mention that this field is keyed by a user but is part of an ERP system so it may have also been ported or otherwise manipulated by one of the programs in our business system. Our system is written in Visual Basic and on top of an Access database if that helps.

Let me know if you need more information.
0
Comment
Question by:slamond
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 38808112
try doing this, instead of Trim

replace(replace(replace([fieldName],chr(13) & chr(10),""),chr(13),""),chr(10),"")

or

trim(replace(replace(replace([fieldName],chr(13) & chr(10),""),chr(13),""),chr(10),""))
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38808119
if that does not work, you will need VBA codes to determine those non printable characters and remove them.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 38808125
Try this in place of the Trim() function.
Function CleanUpString(strInText As String) As String
    Dim p As Integer
    
    p = Len(strInText)
    If p = 0 Then
        Exit Function
    End If
    Do While Asc(Mid(strInText, p)) < Asc(" ")
        p = p - 1
        If p = 0 Then
            Exit Function
        End If
    Loop
    CleanUpString = Trim(Left(strInText, p))
End Function

Open in new window

0
 

Author Closing Comment

by:slamond
ID: 38811375
This simple formula works.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question