Hello everybody
I'm using access 2003
Sometimes I use to open more than form in my project what I need is to check another form if still opened
For example I have :
form name X,Y,Z
I got the focus into X what I need to check is whether Y and Z from are opened ?
Is ther any module on VB for that ... If not any method please ....
5 6476 NeoPa 32,556
Expert Mod 16PB
You have (accidentally) posted this question in the Access Articles section. This is NOT an article.
I'm moving this to the main Access questions forum.
MODERATOR.
NeoPa 32,556
Expert Mod 16PB
Hello everybody
I'm using access 2003
Sometimes I use to open more than form in my project what I need is to check another form if still opened
For example I have :
form name X,Y,Z
I got the focus into X what I need to check is whether Y and Z from are opened ?
Is ther any module on VB for that ... If not any method please ....
The Forms collection holds all the open forms.
You can access it via a loop or via the form's name.
Let us know how you get on with this :)
I found it..........
I declare this module - Public Function Isopen(fn As String) As Boolean 'returns True if form is open
-
If SysCmd(acSysCmdGetObjectState, acForm, fn) <> 0 Then Isopen = True
-
End Function
then I use this function - if ( isopen(X) ) then
-
msgbox "X IS OPEN " ,,vbinformation
-
else
-
msgbox " not open ",,vbinformation
-
end if
byyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
Hello everybody
I'm using access 2003
Sometimes I use to open more than form in my project what I need is to check another form if still opened
For example I have :
form name X,Y,Z
I got the focus into X what I need to check is whether Y and Z from are opened ?
Is ther any module on VB for that ... If not any method please ....
You didn't specify what Version of Access you are running, so I'll stay with the simplest and most basic approach, the Forms Collection. - NeoPa already pointed you in the right direction in that the Forms Collection contains only the Forms that are Opened. If a Form is not contained within this Collection, it is not open.
- Copy and Paste this code in a Standard Code Module.
- Public Function fIsFormOpen(FormName As String) As Boolean
-
Dim frm As Form
-
-
For Each frm In Forms
-
If frm.Name = FormName Then
-
fIsFormOpen = True
-
Exit Function
-
Else
-
fIsFormOpen = False
-
End If
-
Next
-
End Function
- Call the Function as indicated below.
- If fIsFormOpen("X") Then
-
Debug.Print "Form X is Open"
-
Else
-
Debug.Print "Form X is NOT Open"
-
End If
NOTE: After seeing wassimdaccache's Post, you are probably better using his approach.
NeoPa 32,556
Expert Mod 16PB
The Forms approach can be used quite simply : - Public Function IsFormOpen(strForm As String) As Boolean
-
IsFormOpen = False
-
'If form open, the test will always return TRUE, otherwise FALSE
-
On Error Resume Next
-
IsFormOpen = (Forms(strForm).Name = strForm)
-
End Function
Lines 2 & 3 are essentialy unnecessary.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Shyguy |
last post by:
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...
|
by: Susan Bricker |
last post by:
Greetings.
I am trying to position opened forms so that they are cascaded on the
screen. I have discovered the movesize action (for the DoCmd) and Move
property of a form (for Acc 2002/2003). ...
|
by: Susan Bricker |
last post by:
Greetings. I have three forms that are open at the same time. They are
related and cascading. The first form (frmEventAdd) is the anchor. Each
event can have many Trials. The second form is...
|
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
|
by: dbuchanan |
last post by:
VS2005
I've been reading all the help I can on the topic (MSDN, other) but I
can't make sense of this.
Desired behavior;
The user is to choose from the displayed list of the databound combobox...
|
by: Eagle |
last post by:
Hi,
I've got an input form (frmInput) that can be accessed in two ways.
A combobox on this form either gets filled in by a selection on an already
opened form (frmBasic), or one can input a...
|
by: JayDawg |
last post by:
Is there a way to tell access to open or make visible one of two other
forms/subforms depending upon whether the yes no check box is true or
false.
I have a data entry form that collects data on...
|
by: avi1000 |
last post by:
Hi
I want to do something with microsoft Word spell check and I wanted to know if it's possible.
I have a TextBox and I want to check the word in the textbox with the help of Word spellcheck.
I...
|
by: Mohit |
last post by:
Hi all,
I am working on a windows based client server application with
multiple forms. All forms are having custom title bars with no default
bars. There is one main form. Some forms are opened up...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |