UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> What Determines Which Modules Are Open When Vbe Is Opened?, Any Version    
 
   
ws1o
post Feb 17 2017, 12:02 PM
Post#1



Posts: 45
Joined: 30-October 15



Does anyone know what determines which VBA code modules are opened when you launch the MS Access Visual Basic Editor (VBE) environment? It seems like it's kind of random. If I close all the code modules, then close MS Access, the next time I open it and go to the VBE it seems like a few modules are opened, but I don't know why. Any ideas?
Go to the top of the page
 
ScottGem
post Feb 17 2017, 12:09 PM
Post#2


UtterAccess VIP / UA Clown
Posts: 31,764
Joined: 21-January 04
From: LI, NY


If you made any design changes to a form or report, the code module for that object opens in the VBE. The VBE rememinders the code module that were open when last closed.

--------------------
Scott <>
Scottgem's Blog
Microsoft Access MVP since 2007
Author: Microsoft Office Access 2007 VBA
Go to the top of the page
 
ADezii
post Feb 17 2017, 12:11 PM
Post#3



Posts: 1,486
Joined: 4-February 07
From: USA, Florida, Delray Beach


You can execute the following Code to determine which Code Modules are Loaded at any given time:
CODE
Dim aobj As AccessObject

For Each aobj In CurrentProject.AllModules
  If aobj.IsLoaded Then
    MsgBox aobj.Name
  End If
Next
Go to the top of the page
 
ws1o
post Feb 17 2017, 12:20 PM
Post#4



Posts: 45
Joined: 30-October 15



Right, but how about when you close all the modules manually, then hit Save. Then the next time you open Access and go to the VBE view, some modules just (randomly) open up before you even pick any....??
Go to the top of the page
 
RAZMaddaz
post Feb 17 2017, 12:32 PM
Post#5


UtterAccess VIP
Posts: 9,209
Joined: 23-May 05
From: Bethesda, MD USA


PMFJI....

WOW!! I never heard of this before.

Have you tried running Compact & Repair, quit out of the database and then open a different database like you were before?

RAZMaddaz
Go to the top of the page
 
ws1o
post Feb 17 2017, 01:48 PM
Post#6



Posts: 45
Joined: 30-October 15



Yes, but that doesn't seem to matter at all.

And I've seen this behavior quite regularly all along since Access 95...or maybe even Access 2.0.

Never understood it, nor have I ever seen it documented.
Go to the top of the page
 
GroverParkGeorge
post Feb 17 2017, 02:00 PM
Post#7


UA Admin
Posts: 28,630
Joined: 20-June 02
From: Newcastle, WA


I think it's the case that all modules open when the accdb was last closed are re-opened. I think that the default is to open them maximized, so you don't see anything except the one on top, which is, as Scott pointed out, the last one worked on.

Is there a particular problem you are trying to resolve?

--------------------
Go to the top of the page
 
ws1o
post Feb 17 2017, 04:10 PM
Post#8



Posts: 45
Joined: 30-October 15



I don't think it matters at all what module was open last; as I said, I've closed every module, even clicked Reset a couple of times, hit Save, closed MS Access, opened an entirely different accdb or mdb, then come back and reopened the original database and when I opened the Visual Basic Editor, it had a couple of modules already loaded and open. Doesn't seem to be any rhyme or reason for which ones it opens. And I believe every version of Access has always done this. It doesn't seem to do any harm per se, but it is weird behavior, and it would be interesting to know why.
Go to the top of the page
 
ADezii
post Feb 17 2017, 05:24 PM
Post#9



Posts: 1,486
Joined: 4-February 07
From: USA, Florida, Delray Beach


Modules are Loaded On-Demand. If a Variable, Sub-Routine, Procedure, etc. is referenced in a Module during the initial Loading of the Database, the entire Module is Loaded into Memory. Also, Code in any other Module(s) referenced in this Module are loaded. Can this be the case?
Go to the top of the page
 
pere_de_chipstic...
post Yesterday, 04:55 AM
Post#10


UtterAccess Editor
Posts: 10,023
Joined: 8-November 07
From: South coast, England


Hi

This is the behaviour I see in A2007 all the time. If you make any change to a module and save it, then all the modules that were open at the point the save was made will be open the next time you open the VBA window.

To 'reset' this 'memory' I make a change in one module (Adding a carriage return and then deleting it), close all the module windows, compile the code and then click the save button.

hth

--------------------
Warm regards
Bernie
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    20th February 2017 - 04:02 AM