473,569 Members | 2,634 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vb to check form is open

3 New Member
What i wnat to do is check to see if a form is open before a new record can be entered.

If any of the forms are open ( Question3 Reason, Question 4 Reason and Question 9 Comments) I want an error message to be displayed saying something along the lines of

'Sorry you have 'form name here' open. Please click save on the form before continuing'

I started to write a macro which included the run code command but got stuck on the vb and also how to halt the macro if the result of the vb code is true (i was going down the route of form open = true, form not open = false)

any help or guidance would be much appreciated.

Thanks

Steven
Nov 21 '06 #1
1 9837
Tanis
143 New Member
Courtesey of the Dev Ashish web site.

Pass the form name to the following function. Function will return True if form is open and False if it's not.

****** Code Start ********
Function fIsLoaded(ByVal strFormName As String) As Integer
'Returns a 0 if form is not open or a -1 if Open
If SysCmd(acSysCmd GetObjectState, acForm, strFormName) <> 0 Then
If Forms(strFormNa me).CurrentView <> 0 Then
fIsLoaded = True
End If
End If
End Function
'****** Code End ********
Nov 21 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1319
by: Dakanali | last post by:
I have a previous form which user search if there is a domain name. Give the domain name and in xml send the data from domainName=rewuest.form("domainname") to the specify url which is below and i want to check if the domain there is to give me the right results and if not there is in another form below give me the results...i want to check if...
4
3272
by: Terry | last post by:
Hello, I am designing a form from scratch and need to know how to get a Check Box(PASS)to automatically update when the data in a Text Box (MARK), in the same form, is >=24. Using the Event dialogue box for the Check Box, AfterUpdate, I have tried: IIf(>=24,True,False) Also: IIf(>=24,1,0)
9
4919
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 is open so I can flag how the third form acts? Thanks for any help
7
11725
by: Shaldaman | last post by:
Hi Is there a property in MS Access for the following: 1) For a Command Button on a form, is there a property that can be used to determine if it has been clicked? eg: Me!button7.Clicked - I don't know if there is even a property like that(Clicked) 2) For a Text Field on a form, is there a property that can be used to find out if data has...
30
35843
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
3
10579
by: Shelby | last post by:
Hi, how can I check that if the form is already open? Whenever I click on a button, it will open the form. I would like to check if the form is open.
9
41643
by: KelsMckin | last post by:
Hello, I was wondering if there was a way to check there was already a form open before opening a new one, sorry that doesnt seem clear, here is an example: The following button opens a new form private void btnAbout_Click(object sender, EventArgs e) { avernusAbout About = new avernusAbout(); About.StartPosition =...
5
6724
by: Andrew Meador | last post by:
I have a form (Change Card List by Status) with a check box (cboNOT) and a list box (lstStatus). There is an Open Report button that opens a report (Report - Change Card List) which uses a query (SQL -Change Card List). What I want to do is have the form open the report where a filter is set to use the values from the check box AND the...
2
3064
by: KA NMC | last post by:
Current application is built in VB.net 2005 what it does is open other small applications within the form. I'm not using mdi I probably should. Here is my problem The application load - main form only contains a menu strip - once selecting a menu option another form opens within the main form. What I want the app to do is; to check to...
0
7701
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7615
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8130
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7677
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6284
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.