Open the immediate window (using Ctrl-G) type the following:
?Replace("abc", "b", "c")
then hit Enter. Do you get acc back, or an error?
If you get acc back, then the Replace function would appear to be working
correctly, and your problem may be that you haven't applied all of the
service packs (the original version of Access 2000 wouldn't let you use the
Replace function in queries, but the problem was fixed in one of the service
packs).
To get you going, create a custom function that "wraps" the built-in Replace
function:
Function MyReplace(Expression As Variant, Find As Variant, Replace As
Variant) As Variant
MyReplace = Replace(Expression, Find, Replace)
End Function
Go back to your query, and use MyReplace instead of Replace.
If, on the other hand, you didn't get acc back, but got an error instead,
you might have a problem with your References.
This can be caused by differences in either the location or file version of
certain files between the machine where the application was developed, and
where it's being run (or the file missing completely from the target
machine). Such differences are common when new software is installed.
Open any code module and select Tools | References from the menu bar.
Examine all of the selected references.
If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.
If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Louis said:
Tina
Thank you very much foro your helpful feedback. The append query is
built, but when I replace the field name [phone] with the epression, I am
getting the following error message. Any ideas? It is Access 2000.
"Undefined function 'Replace' in expression"
Thank you,
Louis