Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / March 2008

Tip: Looking for answers? Try searching our database.

how do I run an event on a form that spawns a popup after pop is     closed?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bobg.hahc@gmail.com - 25 Mar 2008 20:50 GMT
access 2k;

I've read a million "why doesn't on focus / activate work". I'm very
well aware that on focus doesn't work as most expect.

Here's what I don't understand:
when my form does an openform to open a "pop-up form - that is NOT a
'popup' ", it NEVER EVER runs the deactivate code.

Now - I don't really care about the deactivate code - I REALLY want to
activate code to run.
but if the original form is never "deactivated" when another form is
open from the "on open" of the original; then my original will NEVER
be activated when the popup is closed!!!!

Simply:
When my form opens, it should cause a popup; the user selects a value,
and the popup closes.
There is a "title" field on my form that should be populated with a
global value from the popup window.

How do I tell access to WAIT to populate this field until AFTER the
popup is closed??
(or refresh it after the popup is closed)

AND - I cannot have code in the popup itself assigning the value,
because the popup is called from MANY forms, and it won't know which
form to use to assign values.

TIA -Bob
John W. Vinson - 25 Mar 2008 21:06 GMT
>Simply:
>When my form opens, it should cause a popup; the user selects a value,
[quoted text clipped - 5 lines]
>popup is closed??
>(or refresh it after the popup is closed)

One handy way to do this is to use a trick with Dialog mode. If you open the
popup form with WindowMode := acDialog in the OpenForm method, it will pause
the code in your calling form until the popup form is closed OR until its
Visible property is set to False.

So you can have the "close" button on the popup form simply set the form's
Visible property to False, rather than closing it. In the calling routine you
can then retrieve the value and close the (now invisible) form.

DoCmd.OpenForm "MyPopupForm", WindowMode := acDialog
Me!targetcontrol = Forms!MyPopupForm!controlname
DoCmd.Close acDataForm, "MyPopupForm"

Signature

            John W. Vinson [MVP]

bobg.hahc@gmail.com - 26 Mar 2008 15:47 GMT
On Mar 25, 3:06 pm, John W. Vinson
<jvinson@STOP_SPAM.WysardOfInfo.com> wrote:
> >Simply:
> >When my form opens, it should cause a popup; the user selects a value,
[quoted text clipped - 22 lines]
>
>              John W. Vinson [MVP]

John -

TX SO much for your reply...
I never knew about the window mode property... 1 of the little things
that slipped by I guess :)

This is EXACTLY what I want - to be able to suspend code execution !!
(I wonder - is there a way to do this without using a form's window
mode? ie: could I stop code execution until an event trigers
continuation ? )

I am curious though -
Even when I use the dialog window mode in the form's on open; I notice
that a control box which is equal to a user function (ie: text box
source = fGetMyValue()  )   is still executed PRIOR to completion of
the on open code.

Now - this is easily worked around by un-binding the control, and
assigning it in the on open code - so it's not really a big problem.
BUT - one would certainly expect that the acdialog which halts code
execution would prevent the control's code from being executed in
addition to any other code.

TX again, John!
Bob
bobg.hahc@gmail.com - 26 Mar 2008 15:56 GMT
On Mar 26, 9:47 am, bobg.h...@gmail.com wrote:
> Even when I use the dialog window mode in the form's on open; I notice
> that a control box which is equal to a user function (ie: text box
[quoted text clipped - 9 lines]
> TX again, John!
> Bob

Adden:
I've now done just what I described; but the field's value is not
displayed correctly - even after a "me.refresh".

Is there something special I have to do to get a field to display it's
correct CURRENT value?

TIA (again :)
Bob
John W. Vinson - 26 Mar 2008 18:13 GMT
>Adden:
>I've now done just what I described; but the field's value is not
>displayed correctly - even after a "me.refresh".
>
>Is there something special I have to do to get a field to display it's
>correct CURRENT value?

Shouldn't. Please post your code, and the names and control sources of the
relevant form controls.
Signature


            John W. Vinson [MVP]

John W. Vinson - 26 Mar 2008 18:12 GMT
>I am curious though -
>Even when I use the dialog window mode in the form's on open; I notice
[quoted text clipped - 7 lines]
>execution would prevent the control's code from being executed in
>addition to any other code.

It suspends the code in the *CALLING* form's module; any code in the *CALLED*
form will of course execute as normal. Maybe you need to use the form's Load
event, which executes after the connection to the recordsource has been made.
Signature


            John W. Vinson [MVP]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.