stop VB editor main window from coming up

A

Associates

Hi,

I wonder if i can get some help here. I have some codes that enables me to
send email out from Access Database via Outlook 02. So far, it is working
fine. However, the only issue here is that during the process of sending, i
can see the outlook application is automatically open (the outlook was closed
prior to this). Then, i can see very briefly that the VB editor is opening
and then is closed after a short while.

How do i prevent it from showing the VB editor main windows to the user?
Because most users do not know what it is. I do not want to make them worry
about what they see. Are there any codes that i can use to stop this?

Any help would be greatly appreciated.

Thank you in advance
 
S

Stuart McCall

Associates said:
Hi,

I wonder if i can get some help here. I have some codes that enables me to
send email out from Access Database via Outlook 02. So far, it is working
fine. However, the only issue here is that during the process of sending,
i
can see the outlook application is automatically open (the outlook was
closed
prior to this). Then, i can see very briefly that the VB editor is opening
and then is closed after a short while.

How do i prevent it from showing the VB editor main windows to the user?
Because most users do not know what it is. I do not want to make them
worry
about what they see. Are there any codes that i can use to stop this?

Any help would be greatly appreciated.

Thank you in advance

You could try surrounding the offending code with:

Application.Echo False
....
Application.Echo True

Echo False switches off screen updates. Echo True switches them back on.
If there's an error handler present, be sure to turn echo back on there too,
or your app will appear to freeze.
 
D

Dirk Goldgar

Associates said:
Hi,

I wonder if i can get some help here. I have some codes that enables me to
send email out from Access Database via Outlook 02. So far, it is working
fine. However, the only issue here is that during the process of sending,
i
can see the outlook application is automatically open (the outlook was
closed
prior to this). Then, i can see very briefly that the VB editor is opening
and then is closed after a short while.

How do i prevent it from showing the VB editor main windows to the user?
Because most users do not know what it is. I do not want to make them
worry
about what they see. Are there any codes that i can use to stop this?


I don't see why the VB window would come up unless your code executes a
DoCmd.OpenModule statement, which would be a mistake. Why don't you post
your code so we can see what might be going on?
 
V

vanderghast

You can 'mask' the problem with LockWindowUpdate

Private Declare Function LockWindowUpdate Lib "user32" _
(ByVal hwnd As Long) As Long

but it is preferable to investigate the source of the problem rather than
masking it.

Anyway, if you need the Lock, simply pass the Application.hwndAccessApp to
LockWindowUpdate to 'freeze' the window display, and pass 0 to the same
function to unlock it. Note that as long as the window is frozen, ... it is
frozen, and LOOKS irresponsive (even if it is not). So, have an error
trapping which would unfreeze the window, else, the error message would
never be displayed, and your line of code unfreezing the window could be
never executed, letting your application in a state 'as if' it as frozen.

On Error Resume Next
LockWindowUpdate Application.hwndAccessApp
.. do something
LockWindowUpdate 0
Debug.Assert Err.Number = 0

as example.

Sure, the 'do something' should not depend on a user interraction with the
display, since the form display is frozen, to state the obvious.



Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top