472,958 Members | 2,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 2466
<ChasW> wrote in message news:mp********************************@4ax.com...
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(FieldName, " ", "_")

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*********@hotmail.com> wrote:
<ChasW> wrote in message news:mp********************************@4ax.com...
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(FieldName, " ", "_")

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(StringIn as String) as String
Dim NewString as String
NewString = Replace(StringIn," ","_")
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(collection_tbl.[name], " ",
"_");

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

UPDATE collection_tbl
SET collection_tbl.[alt name] = ReplaceText(collection_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(collection_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
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...
1
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...
3
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...
1
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...
9
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...
2
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...
6
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...
1
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...
1
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...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.