Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent Error messages from being displayed (switch UserContol to Fals

Status
Not open for further replies.

michaelgavtinccom

Programmer
Jul 25, 2002
4
0
0
IL
Because I use Access Runtime, I start Access be Shell function with hidden option.
In case of any error during report generation, an Error message appears and asks to Click OK.
It is not acceptable by me, since report printing is hidden.
I don't know how to avoid error messages appearing.
If I create Access using Automation, than in case of error Access throws exception.
This behavior is desirable for me.
I think I could solve this problem if I knew how to switch UserControl property to "FALSE".

Thanks a lot for any idea.
 

Dear michael,

the usercontrol property only indicates whether the database is opened by a user or by an application it is an read-only property

do set the state of warnings use


docmd.setwarnings = false will turn them off
docmd.setwarnings = true will turn them back on.

and you should NEVER forget to turn them back on.
and you should ALLWAYS turn them off as shortly as possible.

it turns off all warnings, not only those you dislike but also : you are about to delete 1000 records are you sure.

HTH regards Astrid

 
Dear Astrid,

SetWarnings affects warning messages only. It doesn't
prevent Error messages from being displayed.
I've solved this problem yet.
I connect to Access, open my project and after that I close Access by sending "close" message:

HWND AccessWindowHandle= FindWindow("OMain",NULL);
SendMessage(AccessWindowHandle,WM_SYSCOMMAND,LPARAM(SC_CLOSE),NULL);

Access automation object has been left in the memory since I am still connected. After that UserControl's switched to FALSE.

Michael.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top