473,881 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Code to check if form is open

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 value manually after opening the
frmInput directly.
Is there a way in VBA I can detect if the frmInput is opened based on a
selection on frmBasic or if the frmInput is opened as stand alone?
I suppose something in the onload event of frmInput that checks IF frmBasic
is open THEN the combobox has a value based on a field in the open frmBasic
ELSE the combobox is NULL.
No idea what the code would look like in this case.
All help is welcome.

Thx.
Feb 14 '06 #1
3 30562
Eagle wrote:
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 value manually
after opening the frmInput directly.
Is there a way in VBA I can detect if the frmInput is opened based on
a selection on frmBasic or if the frmInput is opened as stand alone?
I suppose something in the onload event of frmInput that checks IF
frmBasic is open THEN the combobox has a value based on a field in
the open frmBasic ELSE the combobox is NULL.
No idea what the code would look like in this case.
All help is welcome.

Thx.


To detect if frmBasic is open you could use this function;

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
Then call it like this;

If fIsLoaded("frmB asic") = True Then
'whatever code you like
End if
Feb 14 '06 #2

"Deano" <de***@mailinat or.com> schreef in bericht
news:43******** **************@ ptn-nntp-reader01.plus.n et...
To detect if frmBasic is open you could use this function;

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
Then call it like this;

If fIsLoaded("frmB asic") = True Then
'whatever code you like
End if


Thanks Deano!
Will give it a go and will get back to you if this does the trick.
Feb 14 '06 #3
CurrentProject. AllForms("frmBa sic").IsLoaded

Feb 15 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5356
by: Dknight | last post by:
Hi, all! I have a problem, how can I check a form data before sending it to server. I have the example below, but first data is sent to server, but after JavaScript checks the data :( I need that JavaSctipt check data and after send it to the server, how can do that? Example: ....
2
7052
by: Ron Rohrssen | last post by:
I'm trying to use the ErrorProvider in order to validate my form. This is working well except that in the event of a failure on my modal dialog, I'd like to keep the dialog open. I open the dialog like this: if (formOptions.ShowDialog(this) == DialogResult.OK) When the user clicks on "Save" in the form I do the validation and regardless of success or failure in the
6
3844
by: traversd | last post by:
Hi there, this is driving me nuts! i have a program that is to be run over night, no interaction from the user. I want the code to start runing when the program is started, but i also want to display a form, so we can see the progress (as it takes a couple of hours to run). If i put the code in form load i do not see the form, if i put the code in a timer and run it after x amount of time, i can't debug it.
1
1605
by: Yammaski | last post by:
Hi In this code the field must have at least 3 characters : (var minLength = 3;) Code: // check for Voornaam if (document.Registreren.Voornaam.value.length < minLength) { alert('You have to fill in at least 3 characters'); return false; }
2
1987
by: Kaur | last post by:
Hi, I have developed an application in MS Access 2000 where I am trying to highlight a record in the list box in form 2 based on the record selected in form 1. The form 1 lists all the Document names and allows me to add new documents. Form 2 has a list box that displays all the document names. Clicking on a document in the list box shows me the details of the selected document. I have over 100 documents in the list box. Basically what...
2
8815
by: morangriffin | last post by:
Hi, New at VB6, I would like to know how to have a form open upon running the VB6 and layer to the front of the forms, Thanks Greg
1
9952
by: stevencarroll19 | last post by:
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...
1
4655
by: Captdreamer | last post by:
Hi there, As it will be very apparent in a moment, I am very new to Access and learning on the fly. (Much fun, but frustrating at the same time) I currently am trying to get a Combo Box that I created with the Combo Box wizard to run its After Update code on Form Open instead. The current code looks like this: Private Sub Combo10_AfterUpdate()
1
1515
Alireza355
by: Alireza355 | last post by:
Dear all, Is there any way to say if a user of the front-end of a given database has a specific form "open"? Thanx a lot...
1
5468
by: Eddie Z | last post by:
I'm trying to make a dialog box pop up and ask the User for their name when they open a particular form. I then want to set the default value of a text box called "EnteredBy" to their name. However the only thing that ever appears in the text box is "#Name?" I don't know what I'm doing wrong. Can somebody please help with the code that I'm missing? So far, in my declarations I have: Dim varUserName as String Then on Form Open I...
0
9926
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9776
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10716
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10812
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9552
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7953
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5976
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.