473,786 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

simple text manipulation

Is it possible, within Access, to create an update query that replaces
all spaces with underscores for text data in a given field?

I am aware that it can be done by going into Edit -> Replace, but an
update query would be much preferred.

Thank you in advance,
Charles
Mar 29 '06 #1
3 2500
<ChasW> wrote in message news:mp******** *************** *********@4ax.c om...
Is it possible, within Access, to create an update query that replaces
all spaces with underscores for text data in a given field?

I am aware that it can be done by going into Edit -> Replace, but an
update query would be much preferred.


UPDATE TableName
Set FieldName = Replace(FieldNa me, " ", "_")

Access 2000 (if patched) or higher.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Mar 29 '06 #2
On Wed, 29 Mar 2006 01:10:14 GMT, "Rick Brandt"
<ri*********@ho tmail.com> wrote:
<ChasW> wrote in message news:mp******** *************** *********@4ax.c om...
Is it possible, within Access, to create an update query that replaces
all spaces with underscores for text data in a given field?

I am aware that it can be done by going into Edit -> Replace, but an
update query would be much preferred.


UPDATE TableName
Set FieldName = Replace(FieldNa me, " ", "_")

Access 2000 (if patched) or higher.


Thanks for making me aware of Replace(), but despite my having access
2000 patched to sp3 and msjet 4.0 patched to the latest version, I am
getting "Undefined function 'Replace' in expression"

... so I did some reading and some say that patching fixes this and
others say that you need to wrap a vb function since msjet does not
support Replace..

I am not sure what the deal is with this function other than it
remains undefined after my patching.

So, since I believe I am correctly patched, I tried making my first VB
function ( reasonably fluent with C++, but a complete VB noob )

Function ReplaceText(Str ingIn as String) as String
Dim NewString as String
NewString = Replace(StringI n," ","_")
ReplaceText = NewString
End function

basically, what I got from here:
http://www.mcse.ms/message1580720.html

but I am not sure how to make this work in my query

Here are two versions of my query, neither yet to work:

UPDATE collection_tbl
SET collection_tbl.[alt name] = Replace(collect ion_tbl.[name], " ",
"_");

and this one that does not seem to be seeing my new module:

UPDATE collection_tbl
SET collection_tbl.[alt name] = ReplaceText(col lection_tbl.[name]);

Any additional help would be appreciated.

Best regards,
Charles

Mar 29 '06 #3

and this one that does not seem to be seeing my new module:

UPDATE collection_tbl
SET collection_tbl.[alt name] = ReplaceText(col lection_tbl.[name]);


not sure why, but i deleted the module from access and re created it
and it saw the newly added wrapper function this time.

thanks for the help!
Charles
Mar 29 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
3728
by: ross | last post by:
I want to do some tricky text file manipulation on many files, but have only a little programming knowledge. What are the ideal languages for the following examples? 1. Starting from a certain folder, look in the subfolders for all filenames matching *FOOD*.txt Any files matching in each folder should be copied to a new subfolder within the current folder called EATING with a new name of *FOOD*COPY.txt
1
8295
by: Joseph Barron | last post by:
Here is a SIMPLE problem that I'm trying to solve. It works in Netscape 6.2, but IE6 gives ""No such interface supported." Below are page1.htm and page2.htm . In page1.htm, there are two dropdown lists. If you change the selection of the left one (e.g. choose parentoption2), it should open up page2.htm in a popup window.
3
3035
by: Fabian | last post by:
I have created a javascript to manipulate a text strong given to it. It works in all the situations I put it in. Now, I want to create a form based interface. Essentially, the use types in the text in a form text box, and it returns the manipulated text. Ideally, I'd like it to return teh text in teh same page, without reloading anything from the server. Problem is, I have no idea how to capture anything entered into a form with...
1
2185
by: Andrew Poulos | last post by:
Say I have a page, which has been created by a third party, and the page may contain some pre-specified text. How can I find and replace that text dynamically? For example, if the page I have contains this HTML: <div id=”oDiv” style="margin-bottom:10px;">{when}</div> <div> <table style="border:1px solid gray"> <tr> <td>blah</td>
9
12337
by: Pete | last post by:
Does anyone have a simple html vbscript or other type of snippet they can share that appends a record to a access database via ADO or DAO? I would like to allow users that don't have Microsoft Access a way of adding records to a access database from a simple web page. I don't want to have to setup ODBC or anything like that I just want to put the web page on the network for anyone to access. Most of the users would use the local access...
2
1390
by: UJ | last post by:
I've got a text box that I'm going to be doing some manipulation on (selecting text, moving stuff around, that kind of thing) but I don't want/need the user to see it while it's going on. I'd like to leave the box up while I'm doing the manipulation but turn off the updating of the text box until I'm done. How can I do this? (At the moment it flashes a couple of times while things are going on and it's annoying.) TIA - Jeff.
6
6830
by: Armel Asselin | last post by:
Hello, I'm searching for a simple command line tool to manipulate XML files. The idea would be commands such as that: xmanip-tool set /document/xpath/@name="value" remove //wrong-nodes add /document/node=\<hello\ < in.xml out.xml so, it would simple add/remove/change commands (either as arguments or input script file), a bit of xpath and the usual Unix parameters (-o output,-f
1
3533
by: blangela | last post by:
Bjarne Stroustrup has a new text coming out called "Programming: Principles and Practice Using C++" (ISBN: 0321543726), due to be published in December of this year. Some of the features of this new text include: *Its history: The text was developed in the author's introductory programming course at Texas A&M and has been used successfully by hundreds of students.
1
1981
by: nick777 | last post by:
Hope the Community can bear with me as I muddle with the vocabulary since I am not really sure if I am going about this the correct way. My question is as follows: If I had some sample data in the form of delimited text, in this case comma-delimited (eg. canned_data.txt) and the format looked roughly like this: name,age,occupation,status "joe blow",21,salesman,married "hanna montana,19,entertainer,single
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10360
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10108
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9960
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.