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 638853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:46:40+00:00 2026-05-13T20:46:40+00:00

In one of the ms-access table I work with we have a text field

  • 0

In one of the ms-access table I work with we have a text field with a set size.
At the end of this field there is some extra code that varies depending on the situation.
I’m looking for a way to remove one of these code but even when the last part is truncated by the field maximum size.

Let’s call the field “field” and the code I’m looking to remove “abc-longcode”.

If I use the replace SQL function with the string abc-longcode the query will only work when the code is complete.

If I also want my update query (that does nothing but remove this specific code at the end of my field) to work on incomplete codes how would that translate into ms-SQL?

It would have to remove (or replace with “” to be precise) all of the following (example of course, not the real codes):

abc-longcode
abc-longcod
abc-longco
abc-longc
abc-long
abc-lon
abc-lo
abc-l

Obviously I could do that with several queries. Each one replacing one of the expected truncated codes… but it doesn’t sound optimal.

Also, when the field is big enough to get all of the code, there can sometime be extra details at the end that I’ll also want to keep so I cannot either just look for “abc-l” and delete everything that follows :\

This query (or queries if I can’t find a better way) will be held directly into the .mdb database.

So while I can think of several ways to do this outside of a ms-sql query, it doesn’t help me.

Any help?
Thanks.

  • 1 1 Answer
  • 1 View
  • 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-05-13T20:46:40+00:00Added an answer on May 13, 2026 at 8:46 pm

    You can write a custom VBA replace method that will replace any of the given cases {“abc-longcode”, … “abc-l”}. This is essentially the same tack as your “several queries” idea, except it would only be one query. My VBA is rusty, but something like:

    public function ReplaceCodes(str as string) as string
         dim returnString as string
    
         returnString = str
         returnString = replace(returnString,"abc-longcode","")
         // ... etc...
    
         ReplaceCodes = returnString
    end function
    

    I may have gotten the parameter order wrong on replace 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using MS Access with a SQL Server back end, I have one table basically
I have a ms access database that has one table for each photo album
I have an abnormally large table for one of my applications in MS Access.
I have a MS access database. In that, one table consists of questions and
I have some code that links to Access and works fine with adodbapi, except
I have a FormView where I pull data from one table (MS Access), and
I have one table called: Transaction. This table has the following fields: (ID,ProductName,Amount,Date) placed
I have a ms access mdb-file like this: table Main: int recordID int status
I have a table of data in MS Access 2007. There are 6 fields
I try to get one data column from a MS-Access table and display it

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.