473,395 Members | 1,468 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,395 software developers and data experts.

Update/replace in MS Access query

3
Hi,

I'm trying to create a query in MS Access to partially update or replace a text field.
I need to remove "Univ" and replace it with "University" from that record without changing anything else.
Can I do this without using replace() or using if()?

Thanks
Jan 10 '20 #1
7 4407
cactusdata
214 Expert 128KB
What's wrong with Replace?

Expand|Select|Wrap|Line Numbers
  1. Update
  2.     YourTable
  3. Set
  4.     [YourField] = Replace([YourField], "Univ", "University")
However, this will also rename, say, Universal to Universityersal, so you may need some expanded and more sophisticated filtering.
Jan 11 '20 #2
BR1134
3
Some records already have "UNIVERSITY" and when I use REPLACE(), they turn into "UNIVERSITYERSITY". I couldn't remove "UNIV" using Instr() ."UNIV" can be anywhere, at the beginning or end of string.
Jan 11 '20 #3
cactusdata
214 Expert 128KB
That's what I wrote:

However, this will also rename, say, Universal to Universityersal, so you may need some expanded and more sophisticated filtering.

and, of course, University to Universityersity etc.

How, and to what degree, to add further parsing and filtering is up to you, as we don't have your data.
Jan 11 '20 #4
BR1134
3
This can be done using Instr()?
Jan 11 '20 #5
cactusdata
214 Expert 128KB
Perhaps. That depends on your data.
If Univ is a full word, try including spaces.

Expand|Select|Wrap|Line Numbers
  1. Update
  2.     YourTable
  3. Set
  4.     [YourField] = Replace([YourField], " Univ ", " University ")
Jan 11 '20 #6
NeoPa
32,556 Expert Mod 16PB
We can't tell you what your question should be.

From your understanding of the data you're dealing with, what rules need to be applied to convert it to what you require?

Without any understanding of your data how can we tell you what your question should be? Sure, we can help once you have a question, but if you only have a half-thought question then all that will happen is it will change every time we give an answer that isn't for the full question - that you haven't told us yet.

What I'm saying here is fairly obvious. It isn't complicated. You need to get the question right before you can expect an answer to it that works.
Jan 12 '20 #7
Rabbit
12,516 Expert Mod 8TB
What about the phrases:
These are contrived examples but these are the things you need to think about when it comes to data entered by humans. If you don't think it can happen, you're going to be unpleasantly surprised one day.

Why do you need to replace it in the first place? Is this a nice to have feature? Or is it a critical feature? If it's the former, I would suggest not bothering because it might be more trouble than it's worth.

A complete solution would require a VBA function that utilizes a complex regex or custom built parsing algorithm. A 90% solution could be one that only uses Replace() on those rows that have '%univ%' and not '%univ[a-z]%'
Jan 13 '20 #8

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

Similar topics

0
by: david liu | last post by:
access 2000 query: here's what i want to do. from an asp page, perform a search on a table in access. i have used sql code in the asp page itself, but i'd rather execute a query in access. i...
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
2
by: Dejan Pujic | last post by:
Hello, I'm having difficulty figuring out how to update values in a certain column, where the new information depends on the previous. Here's a further description: The whole database is for...
1
by: TG | last post by:
How do you update an Access 2000 database table that records a checkbox value into a record? Thanks TG
1
by: wakin | last post by:
When I place the following in my query ProductivityHours: IIf(!=85,actualtimeintounittime(),IIf(.=231,3,Sum(IIf(!=33,!/60,IIf(!=102 Or !=158 Or !=219,0,IIf(!>12 And...
2
by: sumGirl | last post by:
Is it possible to run an access query from the scheduler? I need to update a table in the middle of the night, and so I would like to set up a job on a machine thats on all night so I dont have to...
8
by: s_wadhwa | last post by:
SELECT DISTINCTROW "01C" AS dummy, Buildings.BuildingNumber, UCASE(Buildings.BuildingName) AS BuildingName, Buildings.MasterPlanCode, Buildings.UniformBuildingCode,...
3
by: =?Utf-8?B?TXJrIEJsYWNrYWxs?= | last post by:
Hi all, This is my first attempt to update an access database in VB.Net 2005. It goes broadly as follows (I have condensed it): Dim MyConnection As New Data.OleDb.OleDbConnection...
3
by: austin1539 | last post by:
I am trying to run an Access query from Excel. The query, called "ProdActs1" works in Access and is run from using information from a table called "Queries". When a button is clicked in Excel, data...
2
by: iruwin50 | last post by:
I imported an excel spreadsheet into an access table. There has been updates to the excel sheet, but I'm not entirely sure what, so I would like to import this new excel sheet into the same access...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.