473,503 Members | 2,004 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 4911
This is from MS:

Function IsLoaded(FrmN As String) As Boolean
On Error GoTo err
'--------------------------------------
Const conObjStateClosed = 0
Const conDesignView = 0
If SysCmd(acSysCmdGetObjectState, acForm, FrmN) <> conObjStateClosed
Then
If Forms(FrmN).CurrentView <> 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 conObjStateClosed = 0
Const conDesignView = 0
If SysCmd(acSysCmdGetObjectState, acForm, FrmN) <> conObjStateClosed
Then
If Forms(FrmN).CurrentView <> 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.com:
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.com:
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******@pcdatasheet.com
www.pcdatasheet.com

"Shyguy" <Sh****@shytown.com> wrote in message
news:cg********************************@4ax.com...
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******@pcdatasheet.com
www.pcdatasheet.com

"Shyguy" <Sh****@shytown.com> wrote in message
news:cg********************************@4ax.com...
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
1317
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...
4
3266
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...
7
11710
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...
30
35827
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
10575
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
41622
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...
1
9834
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...
5
6705
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...
2
3058
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...
0
7091
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...
0
7282
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,...
0
7342
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...
1
6998
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...
0
7464
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...
0
4680
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...
0
3171
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...
0
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
741
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.