Unable to invoke subroutine when event fires

J

jerryk

Hi,

I have an Access Form. On one of the fields in the AfterUpdate event is set
to [=setdirty]. In the form's code there is a the following subroutine:

Public Sub setdirty()
bIsDirty = true
End Sub

When I change the field it attempts to call the code but is unable. Instead
the following error message is generated:

"The expression After Update you entered as the event property produced the
following error: The object doesn't contain the Automation object
'setdirty'."

Any ideas what is wrong?
 
M

Marshall Barton

jerryk said:
I have an Access Form. On one of the fields in the AfterUpdate event is set
to [=setdirty]. In the form's code there is a the following subroutine:

Public Sub setdirty()
bIsDirty = true
End Sub

When I change the field it attempts to call the code but is unable. Instead
the following error message is generated:

"The expression After Update you entered as the event property produced the
following error: The object doesn't contain the Automation object
'setdirty'."


If you are calling the procedure directly from a control's
event **property**, then the procedure must be a function
and you must include the parenthesis.
 
J

jerryk

That was it. Thanks!

Marshall Barton said:
jerryk said:
I have an Access Form. On one of the fields in the AfterUpdate event is
set
to [=setdirty]. In the form's code there is a the following subroutine:

Public Sub setdirty()
bIsDirty = true
End Sub

When I change the field it attempts to call the code but is unable.
Instead
the following error message is generated:

"The expression After Update you entered as the event property produced
the
following error: The object doesn't contain the Automation object
'setdirty'."


If you are calling the procedure directly from a control's
event **property**, then the procedure must be a function
and you must include the parenthesis.
 

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