473,545 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ 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=R eplace([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 12810
"Ermi" <ba*******@libe ro.it> wrote in message
news:Bn******** ***********@twi ster1.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=R eplace([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*******@libe ro.it> wrote in message
news:Bn******** ***********@twi ster1.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=R eplace([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
4128
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 : <%=replace(rs1("racelength"),"0"" ","''""''"%> can't figure out how to nest the "replace" routine here thanx for help
1
1731
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 in all sheets and then insert the datas of b1.xls into a.xls. I'm using ADo.Net, ASP.Net and Visual Basic.Net.
4
1927
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" scrolling="auto"> <FRAME name="MainFrame" src="WebPrincipal.aspx" scrolling="auto"> </FRAMESET>
10
13925
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 this code: for oText in incident.fetchText( oRE): strTitle += oText.strip()
0
1385
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
788
by: sooryaprabha | last post by:
how to develop an appilcation using com components in visual basic
0
1420
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 flash animation to a form ? Thanx
1
1756
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 problem is, our login window (Novell Client for Windows 4.91 SP2) has an advanced tab, and in the advanced tab in the eDirectory tab, Tree and Context...
5
9533
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
11623
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 "9017891221" or "7891221" The following query works fine when tested in SQL but fails saying that it doesnt support REPLACE() function
0
7487
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...
0
7680
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. ...
0
7934
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7446
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...
0
7778
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...
0
4966
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3476
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...
0
3459
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
731
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.