Hi,
I'm having bother with the replace function in access 2002, a while back I
remember not being able to get it to work... then suddenly the next time I
tried it did work. Now it doesn't again! I must be doing something wrong
but I don't really know how to change my approach to getting it working.
For example, if I type this in the vba immediate window:
?replace("HELLO","ELLO","ello")
I am returned with:
HELLO
so what's going on here?
Thanks!
Chris 9 4390
The syntax for the Replace function is
Replace(expression, find, replace[, start[, count[, compare]]])
The compare option at the end lets you specify the type of compare to do. If
this is run in a module with the compare option set in the declarations,
that should be used as the default if you don't specify here. To make sure
it always works the same, specify the compare options here.
?Replace("HELLO","ELLO","ello",,vbTextCompare)
Hello
?Replace("HELLO", "ELLO", "ello",,vbBinaryCompare)
HELLO
--
Wayne Morgan
MS Access MVP
"Not Me" <No****@faker.fake.fa.ke> wrote in message
news:bq**********@ucsnew1.ncl.ac.uk... Hi,
I'm having bother with the replace function in access 2002, a while back I remember not being able to get it to work... then suddenly the next time I tried it did work. Now it doesn't again! I must be doing something wrong but I don't really know how to change my approach to getting it working.
For example, if I type this in the vba immediate window:
?replace("HELLO","ELLO","ello")
I am returned with: HELLO
so what's going on here?
Thanks! Chris
"Wayne Morgan" <co***************************@hotmail.com> wrote in message
news:Yq****************@newssvr22.news.prodigy.com ... "Not Me" <No****@faker.fake.fa.ke> wrote in message news:bq**********@ucsnew1.ncl.ac.uk... For example, if I type this in the vba immediate window:
?replace("HELLO","ELLO","ello")
I am returned with: HELLO
so what's going on here?
The syntax for the Replace function is Replace(expression, find, replace[, start[, count[, compare]]])
<snip a little> ?Replace("HELLO","ELLO","ello",,vbTextCompare) Hello
?Replace("HELLO", "ELLO", "ello",,vbBinaryCompare) HELLO
Thanks for your reply,
When trying what you did, I get an error "compile error: wrong number of
arguments or invalid property assignment"
If I type 'replace(' into the code window the popup I get only shows 3
arguments?
Any clues?
Cheers,
Chris
I tried it in Access 2003, they may have added an argument. Check your help
file for Replace and see what it offers (in the immediate window, place the
cursor in the word Replace and press F1). The thing that really has me
confused is that it shouldn't have made a difference in this case. I just
tried it again and it did NOT make a difference. I'll have to do some more
checking.
--
Wayne Morgan
MS Access MVP
"Not Me" <No****@faker.fake.fa.ke> wrote in message
news:bq**********@ucsnew1.ncl.ac.uk... "Wayne Morgan" <co***************************@hotmail.com> wrote in
message news:Yq****************@newssvr22.news.prodigy.com ... "Not Me" <No****@faker.fake.fa.ke> wrote in message news:bq**********@ucsnew1.ncl.ac.uk... For example, if I type this in the vba immediate window:
?replace("HELLO","ELLO","ello")
I am returned with: HELLO
so what's going on here?
The syntax for the Replace function is Replace(expression, find, replace[, start[, count[, compare]]]) <snip a little> ?Replace("HELLO","ELLO","ello",,vbTextCompare) Hello
?Replace("HELLO", "ELLO", "ello",,vbBinaryCompare) HELLO
Thanks for your reply,
When trying what you did, I get an error "compile error: wrong number of arguments or invalid property assignment"
If I type 'replace(' into the code window the popup I get only shows 3 arguments?
Any clues? Cheers, Chris
No, it didn't just work. I had a typo. However, I'm still checking on why
this is making a difference at all since the input string and compare string
are both upper case.
--
Wayne Morgan
MS Access MVP
Ok, the typo was in the original response. I left out a comma.
?Replace("HELLO", "ELLO", "ello",,,vbBinaryCompare)
Hello
?Replace("HELLO", "ELLO", "ello",,,vbTextCompare)
Hello
?Replace("HELLO", "ello", "ello",,,vbTextCompare)
Hello
?Replace("HELLO", "ello", "ello",,,vbBinaryCompare)
HELLO
The above is what I would expect to happen and is what I'm getting now that
I have all of my commas in.
--
Wayne Morgan
MS Access MVP
"Not Me" <No****@faker.fake.fa.ke> wrote in message
news:bq**********@ucsnew1.ncl.ac.uk... "Wayne Morgan" <co***************************@hotmail.com> wrote in
message news:Yq****************@newssvr22.news.prodigy.com ... "Not Me" <No****@faker.fake.fa.ke> wrote in message news:bq**********@ucsnew1.ncl.ac.uk... For example, if I type this in the vba immediate window:
?replace("HELLO","ELLO","ello")
I am returned with: HELLO
so what's going on here?
The syntax for the Replace function is Replace(expression, find, replace[, start[, count[, compare]]]) <snip a little> ?Replace("HELLO","ELLO","ello",,vbTextCompare) Hello
?Replace("HELLO", "ELLO", "ello",,vbBinaryCompare) HELLO
Thanks for your reply,
When trying what you did, I get an error "compile error: wrong number of arguments or invalid property assignment"
If I type 'replace(' into the code window the popup I get only shows 3 arguments?
Any clues? Cheers, Chris
"Wayne Morgan" <co***************************@hotmail.com> wrote in message
news:jB*****************@newssvr23.news.prodigy.co m... Ok, the typo was in the original response. I left out a comma.
?Replace("HELLO", "ELLO", "ello",,,vbBinaryCompare) Hello
?Replace("HELLO", "ELLO", "ello",,,vbTextCompare) Hello
?Replace("HELLO", "ello", "ello",,,vbTextCompare) Hello
?Replace("HELLO", "ello", "ello",,,vbBinaryCompare) HELLO
The above is what I would expect to happen and is what I'm getting now
that I have all of my commas in.
Thanks a lot for your troubles, when I look up the help it does indeed say
exactly what you're saying, however I keep getting the error message:
"compile error: wrong number of arguments or invalid property assignment".
The only way I avoid the error is using only 3 arguments, but then as before
it doesn't work!
Cheers,
Chris
Can you copy and paste what you have into a message?
--
Wayne Morgan
MS Access MVP
"Not Me" <No****@faker.fake.fa.ke> wrote in message
news:bq**********@ucsnew1.ncl.ac.uk... "Wayne Morgan" <co***************************@hotmail.com> wrote in
message news:jB*****************@newssvr23.news.prodigy.co m... Ok, the typo was in the original response. I left out a comma.
?Replace("HELLO", "ELLO", "ello",,,vbBinaryCompare) Hello
?Replace("HELLO", "ELLO", "ello",,,vbTextCompare) Hello
?Replace("HELLO", "ello", "ello",,,vbTextCompare) Hello
?Replace("HELLO", "ello", "ello",,,vbBinaryCompare) HELLO
The above is what I would expect to happen and is what I'm getting now that I have all of my commas in.
Thanks a lot for your troubles, when I look up the help it does indeed say exactly what you're saying, however I keep getting the error message: "compile error: wrong number of arguments or invalid property assignment".
The only way I avoid the error is using only 3 arguments, but then as
before it doesn't work!
Cheers, Chris
It sounds to me as if you have a user defined function call ed Replace
somewhere.
Open a code module
Press the F2 key
In the search box at the top type Replace and search for it
Look to see if the Replace function is in your application or is the VBA one
Terry
"Not Me" <No****@faker.fake.fa.ke> wrote in message
news:bq**********@ucsnew1.ncl.ac.uk... "Wayne Morgan" <co***************************@hotmail.com> wrote in
message news:jB*****************@newssvr23.news.prodigy.co m... Ok, the typo was in the original response. I left out a comma.
?Replace("HELLO", "ELLO", "ello",,,vbBinaryCompare) Hello
?Replace("HELLO", "ELLO", "ello",,,vbTextCompare) Hello
?Replace("HELLO", "ello", "ello",,,vbTextCompare) Hello
?Replace("HELLO", "ello", "ello",,,vbBinaryCompare) HELLO
The above is what I would expect to happen and is what I'm getting now that I have all of my commas in.
Thanks a lot for your troubles, when I look up the help it does indeed say exactly what you're saying, however I keep getting the error message: "compile error: wrong number of arguments or invalid property assignment".
The only way I avoid the error is using only 3 arguments, but then as
before it doesn't work!
Cheers, Chris
"Terry Kreft" <te*********@mps.co.uk> wrote in message
news:BV********************@karoo.co.uk... It sounds to me as if you have a user defined function call ed Replace somewhere.
Open a code module Press the F2 key In the search box at the top type Replace and search for it Look to see if the Replace function is in your application or is the VBA
one
D'oh!
Found one, hiding away in the corner of the database.. god knows where it
came from :o)
Cheers muchly,
Chris This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: higabe |
last post by:
Three questions
1)
I have a string function that works perfectly but according to W3C.org
web site is syntactically flawed because it contains the characters </
in sequence. So how am I...
|
by: Little PussyCat |
last post by:
Hello,
I need to be able to replace only the first occurance of a space character
in a column.
Reason being is the data in the column I am trying to replace seems to have
umpteen space...
|
by: Brian |
last post by:
I want to use regxp to check that a form input contains at least 1
non-space charcter. I'd like to only run this if the browser supports
it. For DOM stuff, I'd use
if (documentGetElementById) {}...
|
by: Jon S via DotNetMonster.com |
last post by:
Hi all,
I searching a string to see if "Desc" resides in it, if so then replace it
with "Description". For some reason if it finds "Desc" in the word
"Description" it replaces the "Desc" part...
|
by: Whitless |
last post by:
Okay I am ready to pull what little hair I have left out.
I pass the function below my String to search, my find string (a regular
expression) and my replace string (another regular expression)....
|
by: Joe HM |
last post by:
Hello -
I have the following very simple code ...
Dim lStringA As String = ""
Dim lStringB As String = ""
....
lStringB = Replace(lStringA, "DUMMY", "", Compare:=CompareMethod.Text)
|
by: ICPooreMan |
last post by:
I've got some code which works in firefox that's giving me fits in
IE7 (maybe other versions too I haven't tested it). What I want to do
is get the oncontextmenu attribute of something, change the...
|
by: SM |
last post by:
Hello,
I have a simple question, but can't find the answer.
I have a string that contains a path to a file
I want to add another string to the end of that string
So, if i have :
path =...
|
by: seanmatthewwalsh |
last post by:
Hi
I have a website that uses an Access 2003 database. I have controls on
my pages that are bound to SqlDataSources that pull data from this
database. In a couple of them, I need to use the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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,...
| |