VBA execution order

L

Len B

HI guys,
I figure that since I've been away, nobody has gone back and seen my
follow-up posts to my earlier (Dec 7th for me 6th in US) question so I
thought I should start a new thread. Hope this is ok. Originally I asked
about stepping through startup code from application launch but it grew into
something more. Here is what I said in my last post.

Sorry for the delay guys. Been sick.
The story so far -
Tables include "Assets" pk=AssetID
"Maintenance" pk=MaintenanceID fk=AssetID
"Depreciation" pk=DepreciationID fk=AssetID
Startup form called "Assets"
based on table "Assets"
has text control "AssetID"
on a tab control
has subform Maintenance based on query q below
has sub subform "Maintenance subform" based on table Maintenance
has subform Depreciation based on query q below
has sub subform "Depreciation subform" based on table Depreciation
both subforms have only Open and Activate events
Open event checks that parent is open. MsgBox if not.
Activate event is DoCmd MenuItem ... acSaveRecord : Me.Requery
neither sub subform has any event handling

q [ SELECT DISTINCTROW Assets.* FROM Assets ]
[ WHERE (((Assets.AssetID)=[forms]![Assets]![AssetID])); ]

All the above worked fine until I added AfterUpdate handling to two
unrelated controls (DateSold and Status) both of which I have
subsequently commented out. Everything between Private Sub & End Sub.

I have added Stop commands to Activate events of parent and both subs,
but execution doesn't reach any of these Activate events.

Here's what happens.
I open app, bypassing auto launching.
Open form Assets
Asked for Forms!Assets!AssetID
Responded 7 <Enter>
Runtime 40036 <<End>> <<Debug>> <<Help>>
<Debug> => IsLoaded of Module GlobalCode, If CurrentView<>DesignView Then
Move cursor to matching End If <Ctrl + F9> <F5> i.e. SetNext and Run
MsgBox saying Maintenance form only openable from Assets form.
(generated by Open event of subform Maintenance above)
<Ok> (to dismiss MsgBox)

I'm asked for Forms!Assets!AssetID a second time
Responded 7 <Enter>
Runtime 40036 <<End>> <<Debug>> <<Help>>
<Debug> => IsLoaded of Module GlobalCode, If CurrentView<>DesignView Then
(hovering on CurrentView = tooltip "Method 'Item' of object 'Forms' failed"
Cursor to next statement <Ctrl + F9> <F5> i.e. set IsLoaded to True this
time

Info PopUp OkOnly Error which says
"The expression OnActivate you entered as the event property setting
produced the following error : Procedure declarations does not match
description of event or procedure having the same name.
*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event or macro.
<<Show Help>> <<Ok>> "
<ShowHelp> lists following possibilities
-Missing Reference - see kb283806 (No missing references found)
-An expression is misspelled (Not that I can see)
-A udf is declared as Sub or as Private Function in a module.
-Security in Access set to Med or High and Jet 4.0 SP8 not installed
As for udf, nothing has changed and it worked before
Security level unchanged but all updates always done anyway.
<Ok> (to dismiss error popup)

Info PopUp OkOnly Error which says
"The expression OnCurrent you entered as the event property setting
etc etc as previously except Current not Activate
<ShowHelp> Same possibilities
<Ok> (to dismiss error popup)

Form "Asset" displays (AssetID=1) but tab control doesn't display subforms.
<NextRecord> prompts for Forms!Assets!AssetID twice (answer 2)
Depreciation subform and sub subform appear.

Subsequent <NextRecord> clicks goes through the prompt for ID and
popup cycle. If I enter the ID in the prompt to match the target
record, the subforms display. If I get one right and one wrong only one
subform will display.

Any ideas anyone?
 

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