473,385 Members | 1,311 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Forms

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
4 2960
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
3
by: Joshua Russell | last post by:
Hi, Both the methods below open up a windows form called MasterForm. However, one works better than the other. Method 1 opens the form correctly but I don't have any reference to the instance of...
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
13
by: MD | last post by:
I have been converting a program from VB6 to VB.Net and enhancing it as well. All has been progressing OK although its been hard work. Now, all of a sudden, when I try to execute a ShowDialog()...
15
by: Joshua Kendall | last post by:
I have a script in which it keeps opening the same form instead of only one instance. I also need help with a form that has a password. Where do I put the actual password? can I use a database for...
3
by: Lloyd Sheen | last post by:
I have the following situation: Need a user resizable user control. After much trying with user control I came across the idea of hosting the controls in a form marked as not TopLevel = false. ...
8
by: Stephen Rice | last post by:
Hi, I have a periodic problem which I am having a real time trying to sort. Background: An MDI VB app with a DB on SQL 2000. I have wrapped all the DB access into an object which spawns a...
3
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes...
6
by: dbuchanan | last post by:
I have a Windows Forms application that accesses SQL Server 2k from a small local network. The application has been used for weeks on other systmes but a new install on a new machine retruns...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.