PC Review


Reply
Thread Tools Rate Thread

check form open and bring it to front

 
 
iccsi
Guest
Posts: n/a
 
      9th Mar 2011
I would like to check form open or not, if not then open the form and
bring it to front, if it opens then bring it to front.

I tried to look myform.open, but does not exist.
I just wonder any command to do the task.

Your help is great appreciated,

 
Reply With Quote
 
 
 
 
Access Developer
Guest
Posts: n/a
 
      9th Mar 2011
DoCmd.OpenForm does exactly what you ask... look it up in Help. You can
defeat it, if you try, by opening other forms as Modal, or as Popup, or as
Dialog... but with all forms opened "acNormal", it opens the form if not
already open, and sets Focus to it (which brings it to the front); if open,
it just sets Focus (which brings it to the front).

Larry Linson
Microsoft Office Access MVP

"iccsi" <(E-Mail Removed)> wrote in message
news:8ee213d0-4b16-4cdf-bbe6-(E-Mail Removed)...
>I would like to check form open or not, if not then open the form and
> bring it to front, if it opens then bring it to front.
>
> I tried to look myform.open, but does not exist.
> I just wonder any command to do the task.
>
> Your help is great appreciated,
>



 
Reply With Quote
 
David-W-Fenton
Guest
Posts: n/a
 
      12th Mar 2011
"Access Developer" <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> DoCmd.OpenForm does exactly what you ask... look it up in Help.
> You can defeat it, if you try, by opening other forms as Modal, or
> as Popup, or as Dialog... but with all forms opened "acNormal", it
> opens the form if not already open, and sets Focus to it (which
> brings it to the front); if open, it just sets Focus (which brings
> it to the front).


Let me second what Larry said -- DoCmd.OpenForm will open it if it's
not open, or bring it to the front if it is (unless, as Larry says,
you've set the properties of the form such that it can't).

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
 
Reply With Quote
 
David-W-Fenton
Guest
Posts: n/a
 
      12th Mar 2011
Marshall Barton <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> iccsi wrote:
>
>>I would like to check form open or not, if not then open the form
>>and bring it to front, if it opens then bring it to front.
>>
>>I tried to look myform.open, but does not exist.
>>I just wonder any command to do the task.
>>

>
> I think this kind of thing should do that:
>
> If CurrentProject.AllForms![form name].IsLoaded Then
> DoCmd.SelectObject acForm, "form name"
> Else
> DoCmd.OpenForm "form name"
> End If
>
> Be sure to check VBA Help for all the stuff that you are not
> already familiar with.


Why would you bother to check, given that DoCmd.OpenForm does the
job without any conditional checking?

(also, note that you left out the period between DoCmd and the
command in your sample code -- I've restored it in the quoted code).

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bring a form to the front Alistair George Microsoft C# .NET 2 24th Sep 2007 09:42 PM
bring a form to front Fox Microsoft Dot NET Framework Forms 0 26th Dec 2005 07:41 AM
Bring form to the front =?Utf-8?B?VEx1ZWJrZQ==?= Microsoft Access Forms 2 27th Oct 2005 08:05 PM
Re: Bring form to front Bruce Microsoft Access Forms 1 15th Sep 2004 06:27 PM
Bring form to front Van T. Dinh Microsoft Access Forms 2 15th Sep 2004 02:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:26 AM.