473,480 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Using the replace function with ADO and an Access db from Visual Basic 6

Hi,
i have this problem....
From a visual basic application I must replace the value contained in a
column with another one....for example

Field1
------
Alfa
Beta
Gamma

If i want to replace "a" with "b" from the query pane of access i can write:
UPDATE Table1 SET Table1.Field1=Replace([Field1],"a","b")
and everithing works fine.

But using the same syntax via a command with ADO I get that error:
"Undefined function Replace"

maybe the syntax with ADO as some difference with the Access sql?

Can someone help me please?
thx

Nov 13 '05 #1
2 12799
"Ermi" <ba*******@libero.it> wrote in message
news:Bn*******************@twister1.libero.it...
Hi,
i have this problem....
From a visual basic application I must replace the value contained in a
column with another one....for example

Field1
------
Alfa
Beta
Gamma

If i want to replace "a" with "b" from the query pane of access i can
write:
UPDATE Table1 SET Table1.Field1=Replace([Field1],"a","b")
and everithing works fine.

But using the same syntax via a command with ADO I get that error:
"Undefined function Replace"

maybe the syntax with ADO as some difference with the Access sql?

Can someone help me please?
thx

The ability to use functions like Replace within an update query is a
'special trick' which MS Access can do, but you cannot use this from vb/ado.
Your options are:
If you are replacing something easy like the first letter in the word, then
you can use functions like left, right, mid, etc which will work from
vb/ado.
If the replace is more complicated, you will need to create an updateable
recordset, looping through and updating each record. Depending on how many
records you have, you may notice a drop in speed with this approach.
However, if it's only a few thousand records, I guess you'll hardly notice
the difference.



Nov 13 '05 #2
Thanks Justin,
unfortunately I ve seen that this "trick" is unavaible from VB even using a
parametric update query.
I'll iterate trough a recordset and update each record as u have been
suggesting me...
Thanks again
Ermanno

"Justin Hoffman" <j@b.com> wrote in message
news:d9**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
"Ermi" <ba*******@libero.it> wrote in message
news:Bn*******************@twister1.libero.it...
Hi,
i have this problem....
From a visual basic application I must replace the value contained in a
column with another one....for example

Field1
------
Alfa
Beta
Gamma

If i want to replace "a" with "b" from the query pane of access i can
write:
UPDATE Table1 SET Table1.Field1=Replace([Field1],"a","b")
and everithing works fine.

But using the same syntax via a command with ADO I get that error:
"Undefined function Replace"

maybe the syntax with ADO as some difference with the Access sql?

Can someone help me please?
thx

The ability to use functions like Replace within an update query is a
'special trick' which MS Access can do, but you cannot use this from
vb/ado. Your options are:
If you are replacing something easy like the first letter in the word,
then you can use functions like left, right, mid, etc which will work from
vb/ado.
If the replace is more complicated, you will need to create an updateable
recordset, looping through and updating each record. Depending on how
many records you have, you may notice a drop in speed with this approach.
However, if it's only a few thousand records, I guess you'll hardly notice
the difference.


Nov 13 '05 #3

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

Similar topics

4
4118
by: J. Muenchbourg | last post by:
I'm using replace function to strip 0s from a particular string: <%=replace(rs1("racelength"),"0","''"%> but I need to also strip empty spaces from the string in question. This doesn't work :...
1
1723
by: Mahesh Kumar | last post by:
hi, I have two excel files(a1.xls and b.xls) each having 4 sheets. I want to read datas of 4 sheets from b1.xls and it has to be inserted in a1.xls as 4 sheets. First it has to delete all datas...
4
1919
by: Giovanni Cobos | last post by:
Hi: I am developing a web page using Visual Basic .NET. I want to put a frame in my web page in which I am using this code <FRAMESET cols="134,84%"> <FRAME name="NavBar" src="WebBarra.aspx"...
10
13903
by: localpricemaps | last post by:
i have some html that looks like this <address style="color:#">34 main,<br> Boston, MA</address> and i am trying to use the replace function to get rid of the <Br> that i scrape out using...
0
1379
by: pmaers | last post by:
I need a source code in Visual Basic .Net regarding about updating data records using MS Access database (.MDB).
0
785
by: sooryaprabha | last post by:
how to develop an appilcation using com components in visual basic
0
1411
by: John Devlon | last post by:
Hi, I've created a small application in Visual basic .NET. On the welcome form, visual at statup for a few seconds, I would like a flash animation. Does anyone know how to add a custom...
1
1753
by: mfpantst | last post by:
I'm trying to implement a Visual Basic that logs a user in to a specific server in our network inthe background while running the code. (This is to acess a secure folder via the program) The...
5
9520
by: Eduard Allen | last post by:
I am a newbie to this site.. Would you help to know the code in progressbar in visual basic 6.0? That after 3 seconds another form will appear. I hope you could help me guys..
2
11607
by: ArunDhaJ | last post by:
Hi, I'm having a DataTable with a column named "Phones" having value like (901) 789 1234<BR>(901) 789 1235<BR>(901) 789 1221 I need to perform filtering based on the phone number of the form...
0
7037
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
6904
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
7034
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,...
1
6732
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...
1
4768
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...
0
4472
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2990
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...
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
174
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.