Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBE window stays open after closing module..

Status
Not open for further replies.

lameid

Programmer
Jan 31, 2001
4,212
US
The Problem
I want to close the VBE window via code...

I am hoping to avoid an API call but if not, pointing to the right API(s) would be helpful.

Why it is open in the first place
I am creating a form and creating it's associated module in code.

This causes the VBE window to open. Even after I close the module, the VBE window remains open with other modules open.
I suspect these just happen to have been used since the application started.

Code:
'strFrmName is a name of form passed to procdure

    Dim frm As Form
    Dim ctl As Control
    Dim mdl As Module
    Dim i As Long

    DoCmd.Echo False
    DesignAndReplaceForm (strFrmName) 'Deletes form if it exists and creates empty form
    DoCmd.OpenForm strFrmName, acDesign
    
    Set frm = Forms(strFrmName)
    Set mdl = Forms(strFrmName).Module
    
   'Code that adds controls here
   'Code that adds code to the module here

    DoCmd.Close acModule, mdl.Name, acSaveYes
    
    Set frm = Nothing
    DoCmd.Close acForm, strFrmName, acSaveYes
    DoCmd.Echo True
   'VBE Window still open

[red]Why I'm doing things this way... (someone will ask)[/red]

I am writing a replacement Access application for an old VB6 program with missing source code that uses an Access backend.

The data is not normalized but for Legacy support I have persisted with same layout. This was clearly written by someone that thinks of tables as placeholder for array data vs. normalization.

Data entry requires key mapping of the numeric keypad which I was only able to accomplish by adding KeyDown and Change events on a varying number of controls
 
Oops...
Application.VBE.MainWindow.Visible = False

Catch 22 here is that every time I Module.insertlines, the VBE windows is made visible but this does keep it from staying visible once changes are made.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top