Timeout when using CurrentDB.Execute

U

UnderGround

Hi All,
I have a query that runs very fast when i run it in the access
interface, but when i run the same query using the docmd command it
times out. It gives the specific error that the Timeout has Expired. I
even tried running the sql for the query using currentDB.Execute with
the same result. The sql for the query is.....

INSERT INTO TblDbSinksBasinOrder ( JobNumber, OrderID, DateRecAdded )
SELECT tblSinkBasin.JobNumber, tblSinkBasin.ID, Date() AS Expr5
FROM tblSinkBasin
WHERE (tblSinkBasin.Supplier Not Like 'Customer' And
tblSinkBasin.Supplier Not Like 'Claytons Kitchens' And
tblSinkBasin.Supplier Not Like 'To Site') AND tblSinkBasin.ID Not In
(select OrderID from TblDbSinksBasinOrder where
orderID=tblSinkBasin.ID);

Any ideas ???
 
U

UnderGround

I found a way around the problem. I was running this query onOpen event
of a form. There was also a sub form in that form. The query behind the
sub form was using the same table in which i was trying to add records
to in my main form. So i guess this was causing problems. I made the
sub forms unbound and onload of my main form i first ran the query and
then set the source object of my sub form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top