Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search for the Square Boxes 1

Status
Not open for further replies.

alr0

Programmer
May 9, 2001
211
US
Hi All,

We have been receiving data for mailing lists in Excel spreadsheets that have a line feed or carriage returns (chr 10 or 13, I believe) When imported into Access the character appears as a square box like many unprintable or foreign characters. I need to alert operators to the presence of characters that require some special handling.

Is there a way that I can search for these square boxes whatever their source.

Thanks,

alr

_____________________________________
There is no rule more invariable than that we are paid for our suspicions by finding out what we expected.

Henry David Thoreau
 
A query may suit:

[tt]SELECT t.Address
FROM tblTable t
WHERE t.Address Like "*" & Chr(10) & "*"
OR t.Address Like "*" & Chr(13) & "*"[/tt]
 
Thanks Remou,

This is very helpful.

I was hoping for a more general solution that would find all characters that show up as square boxes without listing each ascii character.

Any thoughts?

Thanks,

alr

_____________________________________
There is no rule more invariable than that we are paid for our suspicions by finding out what we expected.

Henry David Thoreau
 
I think you would need a function. For example:

Code:
Sub OddChar()
Dim intA
Dim rs As DAO.Recordset

Set rs = CurrentDb.OpenRecordset("tblX")

Do While Not rs.EOF
    
    strText = ""
    
    For i = 1 To Len(rs!testfield)
        intA = Asc(Mid(rs!testfield, i, 1))
        Debug.Print intA
        If intA < 32 Or intA > 166 Or intA = 127 Or intA = 129 _
            Or intA = 141 Or intA = 143 Or intA = 144 Or intA = 157 Then
            strText = strText & " "
        Else
            strText = strText & Mid(rs!testfield, i, 1)
        End If
    Next
    rs.Edit
    rs!testfield = strText
    rs.Update
    rs.MoveNext
Loop

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top