473,763 Members | 5,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Check for Form open?

I have two forms that both open the same (3rd) form.
The third form does the same thing, but a little differently depending
on which form it is opened from. Is there a way I can check which
form is open so I can flag how the third form acts?

Thanks for any help

Nov 13 '05 #1
9 4935
This is from MS:

Function IsLoaded(FrmN As String) As Boolean
On Error GoTo err
'--------------------------------------
Const conObjStateClos ed = 0
Const conDesignView = 0
If SysCmd(acSysCmd GetObjectState, acForm, FrmN) <> conObjStateClos ed
Then
If Forms(FrmN).Cur rentView <> conDesignView Then IsLoaded = True
End If
xit:
Exit Function
err:
IsLoaded = False
End Function
---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004
Nov 13 '05 #2
This is from MS:

Function IsLoaded(FrmN As String) As Boolean
On Error GoTo err
'--------------------------------------
Const conObjStateClos ed = 0
Const conDesignView = 0
If SysCmd(acSysCmd GetObjectState, acForm, FrmN) <> conObjStateClos ed
Then
If Forms(FrmN).Cur rentView <> conDesignView Then IsLoaded = True
End If
xit:
Exit Function
err:
IsLoaded = False
End Function
---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004
Nov 13 '05 #3
Set a global variable to different values from forms 1 and 2. Test this
variable in form 3 to see where it was called from.

gnoel
Shyguy <Sh****@shytown .com> wrote in
news:cg******** *************** *********@4ax.c om:
I have two forms that both open the same (3rd) form.
The third form does the same thing, but a little differently depending
on which form it is opened from. Is there a way I can check which
form is open so I can flag how the third form acts?

Thanks for any help


Nov 13 '05 #4
Set a global variable to different values from forms 1 and 2. Test this
variable in form 3 to see where it was called from.

gnoel
Shyguy <Sh****@shytown .com> wrote in
news:cg******** *************** *********@4ax.c om:
I have two forms that both open the same (3rd) form.
The third form does the same thing, but a little differently depending
on which form it is opened from. Is there a way I can check which
form is open so I can flag how the third form acts?

Thanks for any help


Nov 13 '05 #5
Use the function provided by WindAndWaves in form3 like this:

If IsLoaded("Form1 ") Then
<< Do this >>
ElseIf IsLoaded("Form2 ") Then
<< Do that >>
Else
MsgBox "Neither Form1 Or Form2 Is Open"
End If

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com

"Shyguy" <Sh****@shytown .com> wrote in message
news:cg******** *************** *********@4ax.c om...
I have two forms that both open the same (3rd) form.
The third form does the same thing, but a little differently depending
on which form it is opened from. Is there a way I can check which
form is open so I can flag how the third form acts?

Thanks for any help

Nov 13 '05 #6
Use the function provided by WindAndWaves in form3 like this:

If IsLoaded("Form1 ") Then
<< Do this >>
ElseIf IsLoaded("Form2 ") Then
<< Do that >>
Else
MsgBox "Neither Form1 Or Form2 Is Open"
End If

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com

"Shyguy" <Sh****@shytown .com> wrote in message
news:cg******** *************** *********@4ax.c om...
I have two forms that both open the same (3rd) form.
The third form does the same thing, but a little differently depending
on which form it is opened from. Is there a way I can check which
form is open so I can flag how the third form acts?

Thanks for any help

Nov 13 '05 #7
On Tue, 25 May 2004 03:34:12 GMT, Shyguy wrote:
I have two forms that both open the same (3rd) form.
The third form does the same thing, but a little differently depending
on which form it is opened from. Is there a way I can check which
form is open so I can flag how the third form acts?

Thanks for any help


If the other forms are opening this third form, you can use the third
form's OpenArgs property to determine which form opened it.

In Form1 and Form2:
DoCmd.OpenForm "Form3", , , , , , Me.Name

In Form3's Load event:

If Me.OpenArgs = "Form1" Then
' Do this
ElseIf Me.OpenArgs = "Form2" Then
' Do Something else
Else
' It's not been opened from Form1 or Form2
' Don't do anything
End If
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #8
On Tue, 25 May 2004 03:34:12 GMT, Shyguy wrote:
I have two forms that both open the same (3rd) form.
The third form does the same thing, but a little differently depending
on which form it is opened from. Is there a way I can check which
form is open so I can flag how the third form acts?

Thanks for any help


If the other forms are opening this third form, you can use the third
form's OpenArgs property to determine which form opened it.

In Form1 and Form2:
DoCmd.OpenForm "Form3", , , , , , Me.Name

In Form3's Load event:

If Me.OpenArgs = "Form1" Then
' Do this
ElseIf Me.OpenArgs = "Form2" Then
' Do Something else
Else
' It's not been opened from Form1 or Form2
' Don't do anything
End If
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #9
It appears there are a few methods to do what I need to do. Thank you
all for your help.

Nov 13 '05 #10

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

Similar topics

0
1328
by: Dakanali | last post by:
I have a previous form which user search if there is a domain name. Give the domain name and in xml send the data from domainName=rewuest.form("domainname") to the specify url which is below and i want to check if the domain there is to give me the right results and if not there is in another form below give me the results...i want to check if the domainName in text which returns me the url has the results and response them..How can i do...
4
3280
by: Terry | last post by:
Hello, I am designing a form from scratch and need to know how to get a Check Box(PASS)to automatically update when the data in a Text Box (MARK), in the same form, is >=24. Using the Event dialogue box for the Check Box, AfterUpdate, I have tried: IIf(>=24,True,False) Also: IIf(>=24,1,0)
7
11759
by: Shaldaman | last post by:
Hi Is there a property in MS Access for the following: 1) For a Command Button on a form, is there a property that can be used to determine if it has been clicked? eg: Me!button7.Clicked - I don't know if there is even a property like that(Clicked) 2) For a Text Field on a form, is there a property that can be used to find out if data has been entered in it? I've tried Me!Textfield1.Value = Null but I'm not sure if that's the
30
35890
by: S. van Beek | last post by:
Dear reader A record set can be empty because the condition in the query delivers no records. Is there a VBA code to check the status of a record set, record set empty
3
10588
by: Shelby | last post by:
Hi, how can I check that if the form is already open? Whenever I click on a button, it will open the form. I would like to check if the form is open.
9
41664
by: KelsMckin | last post by:
Hello, I was wondering if there was a way to check there was already a form open before opening a new one, sorry that doesnt seem clear, here is an example: The following button opens a new form private void btnAbout_Click(object sender, EventArgs e) { avernusAbout About = new avernusAbout(); About.StartPosition = FormStartPosition.Manual;
1
9931
by: stevencarroll19 | last post by:
What i wnat to do is check to see if a form is open before a new record can be entered. If any of the forms are open ( Question3 Reason, Question 4 Reason and Question 9 Comments) I want an error message to be displayed saying something along the lines of 'Sorry you have 'form name here' open. Please click save on the form before continuing' I started to write a macro which included the run code command but got stuck on the vb and also...
5
6743
by: Andrew Meador | last post by:
I have a form (Change Card List by Status) with a check box (cboNOT) and a list box (lstStatus). There is an Open Report button that opens a report (Report - Change Card List) which uses a query (SQL -Change Card List). What I want to do is have the form open the report where a filter is set to use the values from the check box AND the value selected from the list box to generate the report. What I can't figure out is how to use the...
2
3074
by: KA NMC | last post by:
Current application is built in VB.net 2005 what it does is open other small applications within the form. I'm not using mdi I probably should. Here is my problem The application load - main form only contains a menu strip - once selecting a menu option another form opens within the main form. What I want the app to do is; to check to make sure that the sub form is not already open. If it is bring it to front. My code.. I created a...
0
9563
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10144
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9997
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9937
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8821
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.