Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8574621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:30:54+00:00 2026-06-11T19:30:54+00:00

In an MS Access 2007 project report, I have the following (redacted) query: SELECT

  • 0

In an MS Access 2007 project report, I have the following (redacted) query:

SELECT SomeCol FROM SomeTable

The problem is, that SomeCol apparently contains some invisible characters. For example, I see one result returned as 123456 but SELECT LEN(SomeCol) returns 7. When I copy the result to Notepad++, it shows as ?123456.

The column is set to TEXT. I have no control over this data type, so I can’t change it.

How can I modify my SELECT query to strip out anything non-numeric. I suspect RegEx is the way to go… alternatively, is there a CAST or CONVERT function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:30:55+00:00Added an answer on June 11, 2026 at 7:30 pm

    You mentioned using a regular expression for this. It is true that Access’ db engine doesn’t support regular expressions directly. However, it seems you are willing to use a VBA user-defined function in your query … and a UDF can use a regular expression approach. That approach should be simple, easy, and faster performing than iterating through each character of the input string and storing only those characters you want to keep in a new output string.

    Public Function OnlyDigits(ByVal pInput As String) As String
        Static objRegExp As Object
    
        If objRegExp Is Nothing Then
            Set objRegExp = CreateObject("VBScript.RegExp")
            With objRegExp
                .Global = True
                .Pattern = "[^\d]"
            End With
        End If
        OnlyDigits = objRegExp.Replace(pInput, vbNullString)
    End Function
    

    Here is an example of that function in the Immediate window with “x” characters as proxies for your invisible characters. (Any characters not included in the “digits” character class will be discarded.)

    ? OnlyDigits("x1x23x")
    123
    

    If that is the output you want, just use the function in your query.

    SELECT OnlyDigits(SomeCol) FROM SomeTable;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In MS Access 2007 query, how can I combine the following 2 queries? SELECT
I have an Access 2007 database that works asynchronously with a MAS200 database. Due
I have a query in Access 2007. It's worked fine for months, but I'm
This code is from an Access 2007 project I've been struggling with. The actual
I'm usually not working with Microsoft products. I have an MS Access 2007 project
I have a access 2007 report for which one of the fields returns a
In Access 2007, I have two tables related such that the (surrogate) PK of
I have an Access 2007 Project with a SQL Server 2005 backend. However, when
I have an ASP.NET 2.0 web project that lives within SharePoint 2007. A couple
So I have this Access Database Project file that I have been tasked to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.