From: Patrick Hatton Patrick on
I have a routine that uses data from a form. Each time I run it, it asks for
input on any field contained in the form.

If I open the form then manually run the query it works fine. When I let it
run throught the code, it cannot see the fields.

Your suggestions are greatly appreciated.

Patrick
From: Marshall Barton on
Patrick Hatton <Patrick Hatton(a)discussions.microsoft.com>
wrote:

>I have a routine that uses data from a form. Each time I run it, it asks for
>input on any field contained in the form.
>
>If I open the form then manually run the query it works fine. When I let it
>run throught the code, it cannot see the fields.

We'll need to see the code that runs the query and the query
to have a chance to figure out what might be wrong.

At this point, all I can say is that when you run a query
with form based parameters, the form MUST be open or you
have to use a method that supplies the parameter values in
the code.

--
Marsh
MVP [MS Access]
From: Daryl S on
Patrick -

Is the form open when you are trying to just run it through the code? If
not, then open the form first. You can make the form inivisible if you don't
want the users to see it.

--
Daryl S


"Patrick Hatton" wrote:

> I have a routine that uses data from a form. Each time I run it, it asks for
> input on any field contained in the form.
>
> If I open the form then manually run the query it works fine. When I let it
> run throught the code, it cannot see the fields.
>
> Your suggestions are greatly appreciated.
>
> Patrick
From: Patrick Hatton on
Yes, the form is open when running.

The query is using: Between [forms]![frmreportform]![startmonth] And
[forms]![frmreportform]![endmonth]

This is the strange part. I can run the query with the form closed, no data.
Open the form, run the query, works fine. When this same thing is done from
the code, it doesn't work.

"Daryl S" wrote:

> Patrick -
>
> Is the form open when you are trying to just run it through the code? If
> not, then open the form first. You can make the form inivisible if you don't
> want the users to see it.
>
> --
> Daryl S
>
>
> "Patrick Hatton" wrote:
>
> > I have a routine that uses data from a form. Each time I run it, it asks for
> > input on any field contained in the form.
> >
> > If I open the form then manually run the query it works fine. When I let it
> > run throught the code, it cannot see the fields.
> >
> > Your suggestions are greatly appreciated.
> >
> > Patrick
From: Patrick Hatton on
not sure how to explain this. I have a large report with many subreports.
The query that is bombing is part of a sub-report. The process requires the
form in question to be open but still the data fields are not recognized.

Between [forms]![frmreportform]![startmonth] And
[forms]![frmreportform]![endmonth]



"Marshall Barton" wrote:

> Patrick Hatton <Patrick Hatton(a)discussions.microsoft.com>
> wrote:
>
> >I have a routine that uses data from a form. Each time I run it, it asks for
> >input on any field contained in the form.
> >
> >If I open the form then manually run the query it works fine. When I let it
> >run throught the code, it cannot see the fields.
>
> We'll need to see the code that runs the query and the query
> to have a chance to figure out what might be wrong.
>
> At this point, all I can say is that when you run a query
> with form based parameters, the form MUST be open or you
> have to use a method that supplies the parameter values in
> the code.
>
> --
> Marsh
> MVP [MS Access]
> .
>