473,765 Members | 1,909 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Event? to know when form is already open in background

P
Hi,

Access 2002. I use DoCmd.OpenForm attached to command buttons to open one
form from another form. All forms are open in dialog mode. When a user tries
to open a form already opened from a form in dialog mode, nothing happens as
expected. I would like to inform the users that the form does not open
because it is already opened in the background. What event do you suggest
using for this? Thank you. P
Nov 12 '05 #1
3 3959
"P" <P@no_spam.co m> wrote in message
news:eS******** ************@ne wssrv26.news.pr odigy.com
Hi,

Access 2002. I use DoCmd.OpenForm attached to command buttons to open
one form from another form. All forms are open in dialog mode. When a
user tries to open a form already opened from a form in dialog mode,
nothing happens as expected. I would like to inform the users that
the form does not open because it is already opened in the
background. What event do you suggest using for this? Thank you. P


There is no event, but you can check before calling DoCmd.OpenForm. In
Access 2000 or later, you can do it like this:

Dim strFormToOpen As String

strFormToOpen = "MyForm"

If CurrentProject. AllForms(strFor mName).IsLoaded Then
MsgBox "That form is already open."
Else
DoCmd.OpenForm strFormToOpen, WindowMode:=acD ialog
End If

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
Nov 12 '05 #2
P
Thank you Dirk. This helps. P.

"Dirk Goldgar" <dg@NOdataSPAMg nostics.com> wrote in message
news:u6******** ******@TK2MSFTN GP12.phx.gbl...
"P" <P@no_spam.co m> wrote in message
news:eS******** ************@ne wssrv26.news.pr odigy.com
Hi,

Access 2002. I use DoCmd.OpenForm attached to command buttons to open
one form from another form. All forms are open in dialog mode. When a
user tries to open a form already opened from a form in dialog mode,
nothing happens as expected. I would like to inform the users that
the form does not open because it is already opened in the
background. What event do you suggest using for this? Thank you. P


There is no event, but you can check before calling DoCmd.OpenForm. In
Access 2000 or later, you can do it like this:

Dim strFormToOpen As String

strFormToOpen = "MyForm"

If CurrentProject. AllForms(strFor mName).IsLoaded Then
MsgBox "That form is already open."
Else
DoCmd.OpenForm strFormToOpen, WindowMode:=acD ialog
End If

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Nov 12 '05 #3
Straight outta the help file....

CurrentProject. AllForms("frmGe tHostName").IsL oaded

returns either True or False. How much easier could it get?

So you could create a function or something...

public function IsFormLoaded(by val strFormName as String) as boolean

IsFormLoaded =CurrentProject .AllForms(strFo rmName).IsLoade d

End Function

If IsFormLoaded("M yForm") Then
...
Else
DoCmd.OpenForm strForm
End If
Nov 12 '05 #4

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

Similar topics

2
4100
by: Julia Baresch | last post by:
Hi everyone, As some of you may know, we've been having trouble with an unrecognized database format error. Today I installed an unfinished project on the workstation of one of my users. It's a query by form in which she enters the criteria of the record she wants in an unbound form, and it pulls only that record and switches to the entry form so she can enter data. I had noticed it was faster than find or filter, so I offered it to...
19
3492
by: Heidi Hundåla | last post by:
Hi ! I have a Wep App in C#. Page_Unload fires after Page_Load, and it seems totally unreasonable when you want to use this event when you _leave_ the page. In my project we wanted to use the Page_Unload - event to clean up the Session variables, but when it turns out that it fires before the end, it screws up the code, and
1
11581
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
5
2793
by: Andy Fish | last post by:
Hi, I have an asp.net web application which uses a pop-up form that works a bit like a dialog box. when the user clicks "OK" it does a postback (basically a form post if you don't know .net) to save the contents of the form, and then I put an onload event to do a window.close. this works fine for hundreds of people on different browsers. However, for one user the window does not close.
3
3986
by: jab3 | last post by:
Hello. I"m new to this group, and to JavaScript in general, so please forgive me if I breach local etiquette. I'm trying to implement some client-side 'dynamic' validation on a form. I'm having a couple of problems, which I'll try to describe. But this e-mail will only reproduce one of them, in a "short" example. What I'm generally doing is having each form entry contained in a div, which as a label, an input with some event handlers,...
18
2338
by: Jerry Boone | last post by:
I'm looking for a way to fire a public sub/function when a form is opened and closed - without using form level events. I have already done some extensive form work with instancing, looping through the forms collection, bringing forms to the front with API via hWnd, et.. and so on. The problem is that users are loosing windows behind others and I thought I would put a list together on an existing left handed menu of (i.e.) "My open...
13
3120
by: Keith Wilby | last post by:
I've never used this event before and I'm struggling. I have this code in it: If MsgBox("You entered " & Me.cboManagerName _ & " - is this the manager's network logon ID?", vbYesNo, "Confrim Manager ID") = vbYes Then Response = acDataErrAdded Else Response = acDataErrContinue Me.cboManagerName.Undo
2
3156
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button then the calender gone actually i want if i click outside off the calender then it should me removed ..How kan i do this ... Pls inform me as early as possible .. I am waiting for ur quick replay ...Here i attached the source code .... <!DOCTYPE...
4
5357
patjones
by: patjones | last post by:
Hi everyone: I have a form in my database called "frmChecks". In the properties for this form, I set On Load to , which points to some code in VB that maximizes the form window and sets a background color gradient for the form. Everything works fine when I open the database and start the form in .accdb mode. However, when I convert the database to .accde mode and open it, I get an error that says "The expression On Load you entered as...
0
9566
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
9393
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,...
1
9946
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
9832
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6646
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5272
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5413
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3921
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
3
2800
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.