The Linux Page

Errors and Form_Open() in MS-Access Main


I wrote some MS-Access code that I want to execute once a day.

I created a table to save the time stamp of the last update. Each time the application starts, I check that variable. If it's 1 or more days off, then I run my update. To make it always work on a day boundary, I had to convert the returned value of Date() in a year, month, day value. I used DatePart() with the "yyyy", "m" and "d" formats. I guess I could have used the Unix date and divide that by 86400 too.

The update copies some data from one database to another. Very simple, although I made a couple of mistakes...

But the main problem here is errors. If there is an error in that function, it is not reported at all. I had a couple small problems and it just did not seem to do anything. I could not add a break point nor look at the log (what log?!)


My solution was to have a copy of that code in another form where it would run in the usual environment. That way I could add a break point and debug the function.

This worked great, also it was a bit annoying, it served the purpose well.

I guess another way would be to copy the content of the Form_Init() function in a public function and call that function from both places.