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

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 12789
"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
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
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
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
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
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
by: sooryaprabha | last post by:
how to develop an appilcation using com components in visual basic
0
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
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
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
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
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...
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
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
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...
0
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...

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.