By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,224 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,224 IT Pros & Developers. It's quick & easy.

Check for Form open?

P: n/a
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
Share this Question
Share on Google+
9 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.