Problem with VB window opening in form

R

raremind

I came into this with this code already written so please bare with
me and also I am very new to Access. I have a form that when you
select a specific item in a drop down box it runs code that collects
from data entry tables and builds a subform. My problem is that the VB
program opens and you see it running through the code and sometimes
the window does not close witch leaves it exposed to change from our
data entry people. Does anyone know why this would happen? What should
I be looking for to change this?

Thanks for your help in advance.
 
S

Stefan Hoffmann

hi,
My problem is that the VB
program opens and you see it running through the code and sometimes
the window does not close witch leaves it exposed to change from our
data entry people. Does anyone know why this would happen?
This normally happens when you are running into an unhandled error. The
VBA IDE opens to debug it.
What should I be looking for to change this?
Look at the sub or function causing the error. Has it an error handler
like e.g.

Private Sub Form_BeforeUpdate(Cancel As Integer)

On Local Error GoTo LocalError

'your code

Exit Function

LocalError:
Cancel = True
MsgBox Err.Description

Private Sub

If your methods don't have any error handling, then add it. Otherwise
you may deactivate the error handling behaviour of the VBA IDE, see imho
Tools\Options. But this is may lead to confusing behaviour of your
application.

mfG
--> stefan <--
 
R

raremind

hi,
Private Sub Form_BeforeUpdate(Cancel As Integer)

On Local Error GoTo LocalError

'your code

Exit Function

LocalError:
Cancel = True
MsgBox Err.Description

Private Sub

If your methods don't have any error handling, then add it. Otherwise
you may deactivate the error handling behaviour of the VBA IDE, see imho
Tools\Options. But this is may lead to confusing behaviour of your
application.

mfG
--> stefan <--

Thanks for the insight, but there is no error. The VB window opens
when the code runs, its not hidden and in many cases it just stays
open. I do not want the code to show when it runs.
 
D

Damon Heron

Clear all Breakpoints in the vb editor screen (menu item Debug). Then
Compile your code.

Damon
 
Top