ADO connection not always enabled

V

Vaughan B

Hi,

We have an excel application that we have added some ADO
code to import data from a SQL Server database (Excel
2002, WinXP, connected to SQL Server 2000 via UDL file,
ADO 2.5). We moved to an ADO connection due to more
flexibility with SQL statements than query defs.

There have been a number of random occurrences where a
user has opened the application, but the VBA/ADO
code/connection does not seem to run (application never
seems to prompt user to enable macros when this
happens). When this does happen, excel app opens up
fine, but ADO queries/code never run for specified events
(no error messages). Simply closing and opening the
application several times seems to somehow fix this
problem.. Is there a known reason for this? This is my
second post (hopefully someone will have an idea where to
look).

Thanks,
Vaughan
 
B

Bill

Hi,

According to my experience, before run the query, it is
better to run the application to connect the database. And
after get data from database, close the connection. I
think you'd better check your code sequence and make sure
that the connection is built before run the query.

Rgs

Bill
 

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