473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Find and replace in acces query

19
I have a table with a single column that contains various data.
Among that data, certain rows contain characters that need to be replaced.
ex: order number: 8651124563357 (the numbers are different for every row)
I need to find all the rows that contain "order number: "and replace 6 characters starting with the 19th:

ex: order number: 86511******57

How do i build that expression?

Thank you
Jul 24 '12 #1
4 2007
Rabbit
12,516 Expert Mod 8TB
You can use the Replace function. Or you can use a combination of the Left and Right functions and concatenate it.
Jul 24 '12 #2
Kan09
19
the data in the table's column looks like this:

ColumnHeader
00:39:43 <- END
08:21:19 OPERATOR DOOR OPENED
08:21:30 OPERATOR DOOR CLOSED
08:21:43 OPERATOR DOOR OPENED
08:21:45 OPERATOR DOOR CLOSED
08:21:58 -> START
08:21:58 order number: 8651124563357

i need the query to check every row and if the row contains "order number :" in it, concatenate only part of the number (first six and last 2).

I don't know how to define the search to use wild cards. I thought of using a iif function with the left and right nested functions, but like i said i don't know how to write the wild cards in the search string and i'm thinking that the replace function would be more suitable for the operation.
Jul 25 '12 #3
twinnyfo
3,653 Expert Mod 2GB
Kan09,

Is this a one time query or something that will have to run frequently?

Either way, one option would be to build a VBA sub to create a recordset, then cycle through the records, check the contents with Like ("*order number*"). If it meets the criteria, update the record with a concatenation of the order number with the masking. One key would b that all of the order numbers would have to be he same number of characters.

It is an interesting and unorthodox table that you have, in terms of the typees of data you have in it, which also begs the question why the masking of the order number after the fact? You should either mask it when it goes in, or only maskit when it is on a form.

Perhaps more explanation is required before we can provide any further guidance.
Jul 25 '12 #4
Mariostg
332 100+
This should get you started:
Expand|Select|Wrap|Line Numbers
  1. SELECT tmp_tbl.columnHeader, InStr([columnHeader],"r:") AS loc, 
  2. Left([columnheader],[loc]+2) & Mid([columnheader],
  3. [loc]+3,6) & "******" & Right([columnheader],2) AS target
  4. FROM tmp_tbl
  5. WHERE (((tmp_tbl.columnHeader) ALike "%Order number%"));
  6.  
You may need to replace the % character with * in the WHERE clause.
Jul 25 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: ddddd | last post by:
How do I place a Command Button on one of my forms that when pressed will open up a find/replace window that I can specify two criterias for search and then have the items I searched for show up on...
4
by: JackRazz | last post by:
I'm trying to use Visual Studio's Find/Replace to match VB declarations. This RegEx works fine in Regulator: ...
2
by: :\\\\derian | last post by:
anyone know where i could find the equivalent of the find / replace windows control for my project? :\\derian
2
by: scorpion53061 | last post by:
This excel find/replace code works great under Excel 2003 but bombs with an error (pasted below the code) in Excel 2000. Can anyone suggest an alternative to make both happy? I am using vb.net...
0
by: D Brown | last post by:
Does anyone know why my .NET development would hang / freeze when performing a Global Find / Replace on all files? I have a large ASP.NET VB Application. I have left the machine for 24 hours but...
0
by: vipal.keshwala | last post by:
I just migrated the access data base onto a new server but when I open the application up and click on find/replace in the find what field I try to right click a paste some information, but the...
0
by: Scott | last post by:
Ok I am using the code below to set the default find option but it does not seem to stick. I query the option with getoptions and it is set to 1 but when the find dialog opens it still is set to...
8
by: John Pye | last post by:
Hi all I have a file with a bunch of perl regular expressions like so: /(^|)\*(.*?)\*(|$)/$1'''$2'''$3/ # bold /(^|)\_\_(.*?)\_\_(|$)/$1''<b>$2<\/ b>''$3/ # italic bold...
1
by: Lengara | last post by:
I have an Access form that will be FTPing information. The FTP info will be using a text file located on the hard drive. This text file will have symbolics in it that will be replaced by entries on...
4
by: Elliot Fraval | last post by:
Hi All, Environment is VBA code in Access 2007. I am having some problems performing a find and replace on text that originates from a memo field in a table. The code is supposed to take...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.