473,413 Members | 1,700 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,413 software developers and data experts.

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 30494
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(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then
If Forms(strFormName).CurrentView <> 0 Then
fIsLoaded = True
End If
End If
End Function
Then call it like this;

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

"Deano" <de***@mailinator.com> schreef in bericht
news:43**********************@ptn-nntp-reader01.plus.net...
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(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then
If Forms(strFormName).CurrentView <> 0 Then
fIsLoaded = True
End If
End If
End Function
Then call it like this;

If fIsLoaded("frmBasic") = 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("frmBasic").IsLoaded

Feb 15 '06 #4

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

Similar topics

2
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...
2
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...
6
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...
1
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...
2
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...
2
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
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...
1
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...
1
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
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...
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
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...
0
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,...
0
Oralloy
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,...
0
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...
0
tracyyun
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...
0
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,...
0
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...
0
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...

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.