DoCmd.SetWarnings = False problem with custom function

J

Job

I have an Access form that when I click the update button it starts a series
of queries one of which is an update query that has an iif statment with a
custom function. When I run the code and set the warnings to false I get the
MaxLocksPerFile error and the database will no longer run that query either
through the code or manually. If I create a new db and import everything
from the old db and comment out the setwarnings, everything works fine.

Any help is appreciated,

Cheers,

Job
 
W

Wayne Morgan

I don't know why you're getting the error, but if the query will run if you
don't use the SetWarnings statement, you may be able to use a different
syntax to run the query.

CurrentDb.Execute "QueryName", dbFailOnError

This will run the query without prompting you. It will return an error if
the query fails to complete successfully.
 
J

Job

Wayne said:
I don't know why you're getting the error, but if the query will run if you
don't use the SetWarnings statement, you may be able to use a different
syntax to run the query.

CurrentDb.Execute "QueryName", dbFailOnError

This will run the query without prompting you. It will return an error if
the query fails to complete successfully.

Wayne,
That did the trick!

Cheers,

Job
 
Top