Unanswered: Access code to log which queries are run
I have to analyse and optimise several Access DB and was wondering if it would be possible to automate some of the process.
Is it possible to write VBA code in Access that 'hooks' into the system and is called each time a query (any query) is run. This could then be used to write to a log file (with timestamps) to help analyse queries and performance.
I'm not holding out much hope, but wondered if anyone had ever done anything similar.
If your queries are run via buttons then you can add the logging code there. This is obviously a major ball ache, however you can also write code to add code to your modules. That was, in fact, the subject of my first question here and it was actually to do exactly what you want to do!
The thing is, there's no one way that these DBs work - it could be on a button calling a macro or calling VB code, on a timer...
These DBs are all of various ages, had various bits of on-going development and built by various people, so there's absolutely no standardisation.
Hence the request for a more generic solution that would somehow hook into the internals in Access to trigger whenever a query is run.
If I was doing this in SQL server, I'd modify each of the stored procs to write to a log file when called and when completed (probably including the params as well, but this wouldn't work with Access as you can run only one command per query.
So I was wondering if anything else that would be possible in Access?
Again, not holding out much hope - looks like I might actually have to do some work ;-(