I have two forms - FORMA and FORMB - that I have not linked. I want to
place a command button on FORMB that causes it to set a control in FORM B to
a person's id currently showing in FORMA. Or to automatically set FORM B to
show a record in FORMB related to the record in FORMA upon opening.
I know how to set the value but ...
How do I determine if FORMA is open from inside a module in FORMB?
fredg - 16 Nov 2007 00:34 GMT
> I have two forms - FORMA and FORMB - that I have not linked. I want to
> place a command button on FORMB that causes it to set a control in FORM B to
[quoted text clipped - 4 lines]
>
> How do I determine if FORMA is open from inside a module in FORMB?
What version of Access?
Access 2000 or newer?
If Not CurrentProject.AllForms("FormA").IsLoaded Then
' FormA is not open
Do something here
Else
' FormA is open
Do something else
End If
In Access 97, copy this function (from the Northwind.mdb sample
database) into a module:
Function IsLoaded(ByVal strFormName As String) As Integer
' Returns True if the specified form is open in Form view or
Datasheet view.
Const conObjStateClosed = 0
Const conDesignView = 0
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <>
conObjStateClosed Then
If Forms(strFormName).CurrentView <> conDesignView Then
IsLoaded = True
End If
End If
End Function
Then code some event:
If Not IsLoaded("FormA") Then
'FormA is not open
Do this
Else
'FormA is open
Do that
End if

Signature
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Flick Olmsford - 17 Nov 2007 01:04 GMT
Thank you very much.
> > I have two forms - FORMA and FORMB - that I have not linked. I want to
> > place a command button on FORMB that causes it to set a control in FORM B to
[quoted text clipped - 42 lines]
> Do that
> End if
Jeff Boyce - 16 Nov 2007 13:05 GMT
Why? You've described "how" you are trying to do something (using two
forms, checking between them). Unless you also provide some specifics of
"what" you are trying to do, you won't get the full benefit of having all
these folks here in the newsgroup. It may be that there are alternate ways
to get done what you want to, if only we knew what that was...

Signature
Regards
Jeff Boyce
www.InformationFutures.net
Microsoft Office/Access MVP
http://mvp.support.microsoft.com/
Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/
> I have two forms - FORMA and FORMB - that I have not linked. I want to
> place a command button on FORMB that causes it to set a control in FORM B to
[quoted text clipped - 4 lines]
>
> How do I determine if FORMA is open from inside a module in FORMB?