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

Forms

P: n/a
Is there a way of seeing whether a form is open or not in access 2000
using visual basic coding, as i want to transfer data from one form to
two different ones depending on which one is open.
Can anyone help
Simo!

Feb 25 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Feb 25, 8:46 am, "simo" <simonbla...@hotmail.comwrote:
Is there a way of seeing whether a form is open or not in access 2000
using visual basic coding, as i want to transfer data from one form to
two different ones depending on which one is open.
Can anyone help
Simo!

When a form is open it is added to the Forms collection. Make an
attempt to reference it - Forms("FormName"). If it is not open an
error will occur. Trap the error and you'll know...

Dim frm as Form

On Error Resume Next
Set frm=Forms("FormName")
If Err<>0 then Msgbox "Form is not available at the moment."

Feb 25 '07 #2

P: n/a
On 25 Feb, 15:14, "storrboy" <storr...@sympatico.cawrote:
On Feb 25, 8:46 am, "simo" <simonbla...@hotmail.comwrote:
Is there a way of seeing whether a form is open or not in access 2000
using visual basic coding, as i want to transfer data from one form to
two different ones depending on which one is open.
Can anyone help
Simo!

When a form is open it is added to the Forms collection. Make an
attempt to reference it - Forms("FormName"). If it is not open an
error will occur. Trap the error and you'll know...

Dim frm as Form

On Error Resume Next
Set frm=Forms("FormName")
If Err<>0 then Msgbox "Form is not available at the moment."
thanks

Feb 25 '07 #3

P: n/a
On 25 Feb 2007 05:46:47 -0800, simo wrote:
Is there a way of seeing whether a form is open or not in access 2000
using visual basic coding, as i want to transfer data from one form to
two different ones depending on which one is open.
Can anyone help
Simo!
You can use the IsLoaded property to determine if a form is open.
In Access 2000 or newer:

If Not CurrentProject.AllForms("FormName").IsLoaded Then
Do something here
Else
Do something else
End If
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Feb 25 '07 #4

P: n/a
On Feb 25, 8:46 am, "simo" <simonbla...@hotmail.comwrote:
Is there a way of seeing whether a form is open or not in access 2000
using visual basic coding, as i want to transfer data from one form to
two different ones depending on which one is open.
Can anyone help
Simo!
You can create a function called isOpen:

Function isOpen(strName As String, _
Optional intObjectType As Variant = acForm)
' Returns True if strName is open, False otherwise.
' Assume the caller wants to know about a form.
isOpen = (SysCmd(acSysCmdGetObjectState, _
intObjectType, strName) <0)
End Function

Then you just check

If isOpen("ProgramName") Then
Feb 26 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.