I've got two forms, Form1 and Form2. Form1 opens invisibly when the database opens. From Form1 (or from a regular module or class module accessed by Form1), is there a way to detect when Form2 opens?
I'm restricted to only coding in Form1 (or a regular module or class module accessed by Form1). The code can't be in another Form's module, and can't be in the application's startup module fired by the AutoExec macro. That's already being used for a different purpose.
I know the restriction makes it hard but that's what I have to work with. Please let me know if you know a way. I'll write an add-in if I have to but would rather avoid that. 6 2638
> "joebob" <jo****@zipcon.n0t> wrote in message news:SZ********************@comcast.com... I've got two forms, Form1 and Form2. Form1 opens invisibly when the database opens. From Form1 (or from a regular module or class module accessed by Form1), > is there a way to detect when Form2 opens?
Using a timer in Form1, poll the loaded status of Form2 with the IsLoaded
function at http://www.mvps.org/access/forms/frm0002.htm
But really, you would be much better have having Form2 announce that it has
loaded.
Timer is good enough for what I'm doing. On the Form_Open event I go
Me.TimerInterval = 250 and on the Form_Timer event I go
If IsLoaded("Form2") Then DoCmd.Close acForm, "Form2": Me.TimerInterval = 0
This only happens once just after startup so it's sufficient. Thanks
"John Winterbottom" <as******@hotmail.com> wrote in message
news:2t*************@uni-berlin.de... "joebob" <jo****@zipcon.n0t> wrote in message news:SZ********************@comcast.com... I've got two forms, Form1 and Form2. Form1 opens invisibly when the database opens. From Form1 (or from a regular module or class module accessed by Form1), > is there a way to detect when Form2 opens? Using a timer in Form1, poll the loaded status of Form2 with the IsLoaded function at http://www.mvps.org/access/forms/frm0002.htm
But really, you would be much better have having Form2 announce that it
has loaded.
joebob wrote: Timer is good enough for what I'm doing. On the Form_Open event I go Me.TimerInterval = 250 and on the Form_Timer event I go
If IsLoaded("Form2") Then DoCmd.Close acForm, "Form2": Me.TimerInterval = 0
This only happens once just after startup so it's sufficient. Thanks
It's a weird program you have there. If I understand you correctly, you
want to check every 1/4 second that a certain form is not open and if it
is open, close it. After that, you don't care if it gets opened again
since you set the timer to 0. Why don't you remove all references to
Form2? In fact, why not remove it from the mdb?
"Salad" <oi*@vinegar.com> wrote in message
news:V4****************@newsread3.news.pas.earthli nk.net... joebob wrote:
Timer is good enough for what I'm doing. On the Form_Open event I go Me.TimerInterval = 250 and on the Form_Timer event I go
If IsLoaded("Form2") Then DoCmd.Close acForm, "Form2": Me.TimerInterval
= 0 This only happens once just after startup so it's sufficient. Thanks
It's a weird program you have there. If I understand you correctly, you want to check every 1/4 second that a certain form is not open and if it is open, close it. After that, you don't care if it gets opened again since you set the timer to 0. Why don't you remove all references to Form2? In fact, why not remove it from the mdb?
Yes it's weird. It's not my form and it needs to stay in the mdb and open
automatically. I just want to close the f%*#er when it pops up and then it
won't bug me again unless I manually open it.
joebob wrote: "Salad" <oi*@vinegar.com> wrote in message It's a weird program you have there. If I understand you correctly, you want to check every 1/4 second that a certain form is not open and if it is open, close it. After that, you don't care if it gets opened again since you set the timer to 0. Why don't you remove all references to Form2? In fact, why not remove it from the mdb?
Yes it's weird. It's not my form and it needs to stay in the mdb and open automatically. I just want to close the f%*#er when it pops up and then it won't bug me again unless I manually open it.
It reminds me of a Whack-A-Mole. :-)
It's too bad the module/macro that opens it can't be modified to open it
hidden. Then you would not need the timer. Or have Form2 open and in
the OnOpen even check OpenArgs and if Null, Cancel it. It the area
OpenArgs has something (called manually) then open it.
Sometimes ya gotta do what you gotta do.
"joebob" <jo****@zipcon.n0t> wrote in message news:<SZ********************@comcast.com>... I've got two forms, Form1 and Form2. Form1 opens invisibly when the database opens. From Form1 (or from a regular module or class module accessed by Form1), is there a way to detect when Form2 opens?
I'm restricted to only coding in Form1 (or a regular module or class module accessed by Form1). The code can't be in another Form's module, and can't be in the application's startup module fired by the AutoExec macro. That's already being used for a different purpose.
I know the restriction makes it hard but that's what I have to work with. Please let me know if you know a way. I'll write an add-in if I have to but would rather avoid that. --
Searching this Group for Detect form you will find some code similiar
to this.
Dim i As Integer
Const FORM_DESIGN = 0
For i = 0 To Forms.Count - 1
If Forms(i).FormName = "frmAdminMenu" Then
If Forms(i).CurrentView <> FORM_DESIGN Then
' do something here
i = Forms.Count ' end the for loop
End If
End If
Next
I used this to find which form is loaded so I could reset the focus to
the proper form without making several versions of the same form.
There is probably an easier way to do what I'm trying to do but this
was quick.
Might help you.
Billie Kennedy http://www.nuketemplate.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: David McCulloch |
last post by:
QUESTION-1:
How can I detect if Norton Internet Security is blocking pop-ups?
QUESTION-2a:
How could I know if a particular JavaScript function has been declared?
QUESTION-2b:
How could I...
|
by: Welie |
last post by:
I apologize if this is a faq. I searched for about 45 minutes and
didn't find a good answer but there are many matching posts.
I have a form which is based on a simple query to a linked table....
|
by: bobh |
last post by:
Hi All,
In AccessXP on the main menu screen I give the user the option to open
this form in either
Edit or Read-Only mode. When the user chooses read-only which I use the
following line
...
|
by: Tom_F |
last post by:
To comp.databases.ms.access --
I know that the recommended way to detect an update to a form, is to
use the form's "Before Update" event, and putting in VBA code like:
Private Sub...
|
by: Midsomer |
last post by:
Hi. I have an Access database with a form containing 4 datasheets and I
allow the user to change column widths. On closing the form, a routine
is fired that saves each column width to an INI file....
|
by: Phil |
last post by:
I can check for MdiChildren.Length=0, but which event handler should I put
this in to detect when a child window is closed?
TIA
Phil.
|
by: Steve |
last post by:
Hi All
I have an on-screen keyboard within a POS program I have written in VB.net
2005, for touch screen computers
I have it set to 'always on top' so the user can move the cursor to...
|
by: Don |
last post by:
I wrote an app that alerts a user who attempts to open a file that the
file is currently in use. It works fine except when the file is
opened by Notepad. If a text file is opened, most computers...
|
by: jonnyboy |
last post by:
Hello,
I have an Access application with a number of forms. On opening one particular form, the application will sometimes appear to get stuck in a loop with 'Calculating...' in the status bar for...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |