Access MODAL form does not seem to act "MODALLY"

Sorry this is a bit long but I hope it is clear...

I have a parameter field PARAM on a parameter form into which I want to 
enter a string validated as comprising three parts made up from different 
fields in the database.

In "native" form on the parameter form it works well as follows:
1 - Double click on PARAM field and that makes a combo box visible and hides 
the PARAM field.
2 - Select from combo and on tab (lost focus) make next combo visible....
etc.
3 - on completion of last combo and tab (lost focus) build the PARAM value 
from the Me.cbo...values and makes all cbos visible=false and PARAM 
visible=true.

It works exactly as I want it to !!

However, I want to use the same functionality in several places in the 
database.

The tidiest way seemed to be to create a Function (I'm not into class 
modules)

OnDoubleClick of PARAM
PARAM=PickImage

Function PickImage opens a small POPUP, MODAL form called frmPickImage with 
three cbo boxes similar to those in the "native" version and uses the same 
basic processing as the "native" form. This works fine within frmPickImage 
itself but the problem is that the Function does not work because Access 
does not seem to treat the small form as truly modal and only return program 
control when the user has completed input - it seems to by asynchronous. The 
code for the funciiton below illustrates what happens.

Public Function PickImage()

DoCmd.OpenForm ("frmPickImage")                ' This opens the form fine 
and triggers the OnOpen event of the form but when open processing completes
                                                                        ' 
program flow IMMEDIATELY returns to the next line rather than waiting for 
the user to complete data
                                                                        ' 
entry and build the (Public) mcCurrentImagePath value from the three cbo 
values.
PickImage = mcCurrentImagePath                    ' Therefore, since the 
value has not been set the function returns null
                                                                        ' 
The frustration is that the frmPickImage works fine and the 
mcCurrentImagePath is built fine but sort-of arrives 
' too late and the function has ended !!!!!!
End Function

It is driving me mad - any help please?

Michael.

 


0
Michael
4/4/2010 5:47:09 PM
access.formscoding 7493 articles. 0 followers. Follow

6 Replies
931 Views

Similar Articles

[PageSpeed] 38

Tom van Stiphout <tom7744.no.spam@cox.net> wrote in
news:e4mir5dt1pfg3af24su95htfesvpvj1n9u@4ax.com: 

> What you need is:
> DoCmd.OpenForm "frmPickImage", WindowMode:=acDialog

I have never quite understood the meaning of the Modal property in a
form. To my way of thinking it ought to be equivalent to specifying
acDialog with DoCmd.OpenForm, but it clearly is not. 

What is it for?

-- 
David W. Fenton                  http://www.dfenton.com/ 
usenet at dfenton dot com    http://www.dfenton.com/DFA/
0
David
4/6/2010 12:21:26 AM
On 6 Apr 2010 00:21:26 GMT, "David W. Fenton"
<XXXusenet@dfenton.com.invalid> wrote:

I have wondered about that myself. The property seems to create some
modal behavior without the blocking DoCmd.OpenForm call.

-Tom.
Microsoft Access MVP


>Tom van Stiphout <tom7744.no.spam@cox.net> wrote in
>news:e4mir5dt1pfg3af24su95htfesvpvj1n9u@4ax.com: 
>
>> What you need is:
>> DoCmd.OpenForm "frmPickImage", WindowMode:=acDialog
>
>I have never quite understood the meaning of the Modal property in a
>form. To my way of thinking it ought to be equivalent to specifying
>acDialog with DoCmd.OpenForm, but it clearly is not. 
>
>What is it for?
0
Tom
4/6/2010 2:56:50 AM
David W. Fenton wrote:

> Tom van Stiphout <tom7744.no.spam@cox.net> wrote in
> news:e4mir5dt1pfg3af24su95htfesvpvj1n9u@4ax.com:
> 
>> What you need is:
>> DoCmd.OpenForm "frmPickImage", WindowMode:=acDialog
> 
> I have never quite understood the meaning of the Modal property in a
> form. To my way of thinking it ought to be equivalent to specifying
> acDialog with DoCmd.OpenForm, but it clearly is not.
> 
> What is it for?

It's for forcing the user to deal with the form and close it before they can 
do anything else in the app.  Can you envision no circumstance where that is 
desirable without the code-pausing behavior of acDialog?



0
Rick
4/6/2010 6:32:58 AM
Tom van Stiphout <tom7744.no.spam@cox.net> wrote in
news:8m8lr59dsdmi08q1vj53v3mq4a55qfopc0@4ax.com: 

> I have wondered about that myself. The property seems to create
> some modal behavior without the blocking DoCmd.OpenForm call.

So how is that "modal"? It contradicts my understanding of the
fundamental definition of the term. 

-- 
David W. Fenton                  http://www.dfenton.com/ 
usenet at dfenton dot com    http://www.dfenton.com/DFA/
0
David
4/7/2010 1:33:05 AM
Rick Brandt <rickbrandt2@hotmail.com> wrote in
news:hpf62m$plj$1@news.eternal-september.org: 

> David W. Fenton wrote:
> 
>> Tom van Stiphout <tom7744.no.spam@cox.net> wrote in
>> news:e4mir5dt1pfg3af24su95htfesvpvj1n9u@4ax.com:
>> 
>>> What you need is:
>>> DoCmd.OpenForm "frmPickImage", WindowMode:=acDialog
>> 
>> I have never quite understood the meaning of the Modal property
>> in a form. To my way of thinking it ought to be equivalent to
>> specifying acDialog with DoCmd.OpenForm, but it clearly is not.
>> 
>> What is it for?
> 
> It's for forcing the user to deal with the form and close it
> before they can do anything else in the app.  Can you envision no
> circumstance where that is desirable without the code-pausing
> behavior of acDialog? 

None at all, in fact.

-- 
David W. Fenton                  http://www.dfenton.com/ 
usenet at dfenton dot com    http://www.dfenton.com/DFA/
0
David
4/7/2010 1:33:48 AM
Thank you Tom,

It works exactly as I want it to now. The access definition of Modal seems 
to be rather quirky.

Michael.

"Tom van Stiphout" <tom7744.no.spam@cox.net> wrote in message 
news:e4mir5dt1pfg3af24su95htfesvpvj1n9u@4ax.com...
> On Sun, 4 Apr 2010 18:47:09 +0100, "Michael" <michaelj@dsl.pipex.com>
> wrote:
>
> What you need is:
> DoCmd.OpenForm "frmPickImage", WindowMode:=acDialog
>
> -Tom.
> Microsoft Access MVP
>
>
>>Sorry this is a bit long but I hope it is clear...
>>
>>I have a parameter field PARAM on a parameter form into which I want to
>>enter a string validated as comprising three parts made up from different
>>fields in the database.
>>
>>In "native" form on the parameter form it works well as follows:
>>1 - Double click on PARAM field and that makes a combo box visible and 
>>hides
>>the PARAM field.
>>2 - Select from combo and on tab (lost focus) make next combo visible....
>>etc.
>>3 - on completion of last combo and tab (lost focus) build the PARAM value
>>from the Me.cbo...values and makes all cbos visible=false and PARAM
>>visible=true.
>>
>>It works exactly as I want it to !!
>>
>>However, I want to use the same functionality in several places in the
>>database.
>>
>>The tidiest way seemed to be to create a Function (I'm not into class
>>modules)
>>
>>OnDoubleClick of PARAM
>>PARAM=PickImage
>>
>>Function PickImage opens a small POPUP, MODAL form called frmPickImage 
>>with
>>three cbo boxes similar to those in the "native" version and uses the same
>>basic processing as the "native" form. This works fine within frmPickImage
>>itself but the problem is that the Function does not work because Access
>>does not seem to treat the small form as truly modal and only return 
>>program
>>control when the user has completed input - it seems to by asynchronous. 
>>The
>>code for the funciiton below illustrates what happens.
>>
>>Public Function PickImage()
>>
>>DoCmd.OpenForm ("frmPickImage")                ' This opens the form fine
>>and triggers the OnOpen event of the form but when open processing 
>>completes
>>                                                                        '
>>program flow IMMEDIATELY returns to the next line rather than waiting for
>>the user to complete data
>>                                                                        '
>>entry and build the (Public) mcCurrentImagePath value from the three cbo
>>values.
>>PickImage = mcCurrentImagePath                    ' Therefore, since the
>>value has not been set the function returns null
>>                                                                        '
>>The frustration is that the frmPickImage works fine and the
>>mcCurrentImagePath is built fine but sort-of arrives
>>' too late and the function has ended !!!!!!
>>End Function
>>
>>It is driving me mad - any help please?
>>
>>Michael.
>>
>>
>> 


0
Michael
4/8/2010 7:45:47 PM
Reply:

Similar Artilces:

Access MODAL form does not seem to act "MODALLY"
Sorry this is a bit long but I hope it is clear... I have a parameter field PARAM on a parameter form into which I want to enter a string validated as comprising three parts made up from different fields in the database. In "native" form on the parameter form it works well as follows: 1 - Double click on PARAM field and that makes a combo box visible and hides the PARAM field. 2 - Select from combo and on tab (lost focus) make next combo visible.... etc. 3 - on completion of last combo and tab (lost focus) build the PARAM value from the Me.cbo...values and makes all...