Issue running export query in vba (1 Viewer)

Jayce72

Registered User.
Local time
Today, 09:53
Joined
Sep 26, 2011
Messages
60
In VBA I have set a timer on a form to run a query and export to a specific folder as an excel file.

If I open the database as 'File Open' and open the form and let the timer run it exports perfectly.

As soon as I put the database into runtime - the Timer code kicks in and starts running but as soon as it hits the export line. It stops and then does nothing

I have tried several combinations of either:
- docmd.runsavedimportexport "Query"
- docmd.outputTo acquery etc etc

Any ideas anyone please???
 

Rx_

Nothing In Moderation
Local time
Today, 02:53
Joined
Oct 22, 2009
Messages
2,803
Have you added Error Trapping Code?
Using the On Error to create a custom error trap and message might be very useful at the point of failure.
 

Mihail

Registered User.
Local time
Today, 11:53
Joined
Jan 22, 2011
Messages
2,373
We need to see your code.
 

Jayce72

Registered User.
Local time
Today, 09:53
Joined
Sep 26, 2011
Messages
60
Thank you to those who responded.

I have now resolved the issue.

When I ran another working Query that has been ok for years - that failed as well. Therefore, I went back through my clients to the point I added the new timer code and the original Queries worked fine. Therefore, I created a new form and put my timer code onto that one.

In testing I have now found that if I run my standard queries without opening the new form it works fine. As soon as I open the new form with timer code, this form now works perfectly well - BUT the standard queries are broken again until I reopen the database.

Go figure - Therefore I only intend to open the timer code form as and when I need it. Not ideal - but it works
 

Users who are viewing this thread

Top Bottom