473,564 Members | 2,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there a way to detect when a particular form is opened?

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.
Nov 13 '05 #1
6 2655
> "joebob" <jo****@zipcon. n0t> wrote in message
news:SZ******** ************@co mcast.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.
Nov 13 '05 #2
Timer is good enough for what I'm doing. On the Form_Open event I go
Me.TimerInterva l = 250 and on the Form_Timer event I go

If IsLoaded("Form2 ") Then DoCmd.Close acForm, "Form2": Me.TimerInterva l = 0

This only happens once just after startup so it's sufficient. Thanks

"John Winterbottom" <as******@hotma il.com> wrote in message
news:2t******** *****@uni-berlin.de...
"joebob" <jo****@zipcon. n0t> wrote in message
news:SZ******** ************@co mcast.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.

Nov 13 '05 #3
joebob wrote:
Timer is good enough for what I'm doing. On the Form_Open event I go
Me.TimerInterva l = 250 and on the Form_Timer event I go

If IsLoaded("Form2 ") Then DoCmd.Close acForm, "Form2": Me.TimerInterva l = 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?

Nov 13 '05 #4
"Salad" <oi*@vinegar.co m> wrote in message
news:V4******** ********@newsre ad3.news.pas.ea rthlink.net...
joebob wrote:
Timer is good enough for what I'm doing. On the Form_Open event I go
Me.TimerInterva l = 250 and on the Form_Timer event I go

If IsLoaded("Form2 ") Then DoCmd.Close acForm, "Form2": Me.TimerInterva l = 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.
Nov 13 '05 #5
joebob wrote:
"Salad" <oi*@vinegar.co m> 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.
Nov 13 '05 #6
"joebob" <jo****@zipcon. n0t> wrote in message news:<SZ******* *************@c omcast.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).FormNa me = "frmAdminMe nu" Then
If Forms(i).Curren tView <> 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
Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
6487
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 know if Window.Open has been redefined? BACKGROUND:
2
1729
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. The data is set to no edits,additions,deletions,dataEntry. If the form is open, but the linked table is opened seperately in design mode, than a...
2
10101
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 DoCmd.OpenForm "frmLookupAgencyContactInfo", , , , acFormReadOnly, , strSQL
4
3396
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 Form_BeforeUpdate(Cancel As Integer) Me.Last_changed_date = Date End Sub Then, the field "Last_changed_date" on the form would show the date of
2
2172
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. When the form is opened, the INI file is read and sets up the column widths for the user. Works well, but there is a slight delay on closing...
12
6216
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.
6
2208
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 different text boxes and type using the on-screen keyboard The keyboard launches via the mouseclick event for any text box If another form is launched,...
36
5351
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 are configured to use Notepad to open the file by default and if they are configured to use Notepad by default I want it to remain that way rather...
6
13387
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 some time. This is a problem when using the database on a server, since it seems to be running the same query over and over again. There is one...
0
7583
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.