From: WillyNPG on
I believe you are correct Steve. The puzzle is why does the help screen
article include a macro to open the form using the Not IsLoaded("Date Range")
in the condition if there is no way to make the form open before the query
is run. Perhapse it can only work in an application written in VB

"Steve Schapel" wrote:

> Willy,
>
> As I stated in the other group where you posted this...
>
> The behaviour you have described is expected. The form will not, and can
> not be made to, open when the query is run. If the query uses criteria
> based on the values of controls on a form, then the form has to be open in
> advance.
>
> As for the macros, it sounds like you are using Access 2007 and they are
> embedded macros. That is fine... but they won't appear in the Navigation
> Pane.
>
> --
> Steve Schapel, Microsoft Access MVP
>
>
> "WillyNPG" <WillyNPG(a)discussions.microsoft.com> wrote in message
> news:01FCBD7F-74A7-4ACC-8072-2A995EFE7790(a)microsoft.com...
> > I am trying to use a form to get query parameter dates as is detailed in
> > the
> > help article "Make a query ask for input" The query does not open the date
> > range form when the query is used If the form is opened in advance and
> > dates
> > entered then the dates in the form are used what is missing? How is the
> > open
> > form macro called ?
>
> .
>
From: KenSheridan via AccessMonster.com on
I haven't seen the Help topic in question, but using a macro, one approach
would be to run the following actions in the macro:

1. OpenForm: open the form for entering the parameter in Dialog mode. When
a form is opened in dialogue mode the execution of the macro will pause until
the form is closed or hidden.

2. OpenQuery: open the query which references the form.

In the dialogue form hide it by putting the following line of code in
whatever event is used to confirm the parameter entered. This could be the
AfterUpdate event procedure of the control in which the parameter is entered
(if only one parameter) or the Click event procedure of a separate button (if
more than one parameter, e.g. the start and end of a date range, is entered)

Me.Visible = False

However, this still requires the macro to be run to open the query. There is
no way opening a query directly will trigger a macro or will automatically
open the dialogue form in any other way. While the above will work I don't
see that it has any advantage over simply opening the form, and then opening
the query ( or preferably a form or report based on it) from the form.

Ken Sheridan
Stafford, England

WillyNPG wrote:
>I believe you are correct Steve. The puzzle is why does the help screen
>article include a macro to open the form using the Not IsLoaded("Date Range")
>in the condition if there is no way to make the form open before the query
>is run. Perhapse it can only work in an application written in VB
>
>> Willy,
>>
>[quoted text clipped - 19 lines]
>>
>> .

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/201003/1

First  |  Prev  | 
Pages: 1 2
Prev: pivot table calculations
Next: runtime access