Solved

Access 2003 Query Is Finding Fields With Non-Alphanumeric Data

Posted on 2013-01-22
4
347 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
  • 2
4 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero 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 119

Expert Comment

by:Rey Obrero
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now