user-defined update query problem

  • Thread starter Thread starter drew
  • Start date Start date
D

drew

Hi All,

I have 3 tables in which I need to routinely replace certain
characters.

As I am still using Access 97, I use a user-defined replace function (a
public function created by Terry Kerft that I have stored in a module)
in update queries to do the replace.

I made a second function that calls the Replace function
(Replacechar)to allow for replacing all of the necessary characters at
one - both functions work fine when I do the update queries in design
view.

However, when I try to run the queries from code I get an "undefined
function error." I would like to be able to run the queries from code
(public function would be great) to make it less cumbersome and avoid
all of the alerts since ideally this would be done as soon as new data
is imported. Here is the code:

Dim db As Database
Set db = CurrentDb()
db.Execute "UPDATE Specific_actions SET
Specific_actions.Specific_action = replacechar([Specific_action]),
Specific_actions.Documents = replacechar([Documents]);", dbFailOnError
set db=nothing


Thanks,
Drew
 
Make sure the replacechar function is spelled correctly and public, or the
..Execute will not find it, even if it is in the same module.

You can also run the query from code, if it is an action query.
Update, Append to table, Make table, Alter table all come to mind.

db.QueryDefs("MyQuery").Execute


Mike Schlosser
 
Back
Top