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
>-----Original Message-----
>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
>
>.
>
|