Re: VBA execution
- From: "Len B" <gonehome@optusnet:con:au>
- Date: Thu, 13 Dec 2007 14:17:52 +1000
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)
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?
--
Len
______________________________________________________
"Len B" <gonehome@optusnet:con:au> wrote in message
news:%23cjbQCGOIHA.2064@xxxxxxxxxxxxxxxxxxxxxxx
I have a couple of general questions about VBA.
Is there a way to single step through the start-up code of an application?
Effectively, what I am looking for is a setting somewhere that will set a
breakpoint at the very first line of code, allowing me to single step from
there when I first launch the application.
Secondly, is there a resource which will tell me in what order SUBs will
be executed? Obviously, for a form, OnActivate will execute before
OnCurrent but the order for others is not so apparent.
I have often wondered about execution order but what brought this to a
head was that I was editing a form (the start-up form Assets) containing a
DateSold text control and a Status combo control (to select from
InService, Inactive and Sold). I added AfterUpdate code to each.
For the DateSold it set the combo to sold.
For the combo I sent the cursor to the DateSold field if it was blank.
Now when the application launches, I am confronted with a series errors,
none of which refer to selling an asset. A dialog box demands a value for
Forms!Assets!AssetID. Humouring it with a valid value results in Runtime
err 40036. Choosing Debug opens the code window in the IsLoaded
function... etc. etc.
I want to be able to see, step by step, what is happening. I cannot
believe my AfterUpdate code is at fault because I commented it out but
still the errors come.
TIA
--
Len
______________________________________________________
.
- References:
- VBA execution
- From: Len B
- VBA execution
- Prev by Date: Re: Survey Form
- Next by Date: Parameter Query Dialog Box Msg
- Previous by thread: Re: VBA execution
- Next by thread: Decisions about db setup...
- Index(es):
Relevant Pages
|