Kenneth Courville wrote:
[color=blue]
> Hello, I'm looking for assistance with the Access object model. I know
> this is VB, but I'm building an Office Add-using C# directed at Access
> 2002. I'm literate in VB, so you can reply in VB... I think my problem
> mainly lies in knowing the quirks of the Access object model.
>
> Basically, I'm looking for a method of determining if an Access database
> is open yet. AND I'm looking for a method that doesn't not require
> checking for an exception. It seems that even handled exceptions will
> cause the add-in to not close properly.... eating up memory.
>
> Currently, I have a timer that starts upon opening Access. Every 1/2
> second, the timer_elasped event checks to see if a database is open.
>
> So far, I found that I can check the property Application.Forms.Count >
> 0, which doesn't throw an exception if a database isn't open yet, but
> still seems to cause the MSACCESS process to not close entirely upon
> exit. And I've isolated the code the the use of this property. If I
> take it out, the MSACCESS closes fine.
>
> Ultimately, the process I'm try to automate:
> - User opens Access.
> - Add-in launches and waits for a database to be loaded.
> - Database is loaded.
> - Add-in detects database is opened
> - Add-in determines if the current database is an ADE or ADP file
> (Access Project).
>
> If anyone has other suggestions for accomplishing this, I would greatly
> appreciate it.
>
> Thanks.
>
> *** Sent via Developersdex
http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it![/color]
Don't know. However, it seems you want to close Access cleanly. I
suppose you have a form that is open with your timer interval. In the
OnClose or OnDeavtivate event of the form set your timer interval to 0.
Make sure the form closes correctly.