WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Show a report filtered by text fields of a form

 
   Home -> Office other -> Reports RSS
Next:  Table Setup and Reports Suggestions  
Author Message
Jose Garcia

External


Since: Oct 08, 2009
Posts: 3



(Msg. 1) Posted: Thu Oct 08, 2009 8:12 am
Post subject: Show a report filtered by text fields of a form
Archived from groups: microsoft>public>access>reports (more info?)

Hi,

I have a report which I want to filter depending of the values of two field
text of a form.

For that reason I have created a macro using the command OpenReport, where
in the filter condition field I have put:

[Name of the report field1]=[Forms]![FormName]![Name of the form field1]
AND [Name of the report field2]=[Forms]![FormName]![Name of the form field2]

But It doesnt run because, when I try to execute; it appears to me 2 text
boxs asking about these two field values.

I would be grateful if somebody could help me to solve this problem

Regards

Jose
Back to top
Login to vote
Marshall Barton

External


Since: Dec 07, 2003
Posts: 1697



(Msg. 2) Posted: Thu Oct 08, 2009 11:19 am
Post subject: Re: Show a report filtered by text fields of a form [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Jose Garcia wrote:
>I have a report which I want to filter depending of the values of two field
>text of a form.
>
>For that reason I have created a macro using the command OpenReport, where
>in the filter condition field I have put:
>
>[Name of the report field1]=[Forms]![FormName]![Name of the form field1]
>AND [Name of the report field2]=[Forms]![FormName]![Name of the form field2]
>
>But It doesnt run because, when I try to execute; it appears to me 2 text
>boxs asking about these two field values.


You need to replace the generic names with the real report,
field, form and control names. The names must be spelled
correctly.

--
Marsh
MVP [MS Access]
Back to top
Login to vote
Jose Garcia

External


Since: Oct 08, 2009
Posts: 3



(Msg. 3) Posted: Tue Oct 13, 2009 6:53 am
Post subject: Re: Show a report filtered by text fields of a form [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Marshall Barton" wrote:


> You need to replace the generic names with the real report,
> field, form and control names. The names must be spelled
> correctly.
>
> --
> Marsh
> MVP [MS Access]
>

Hi Marsh

The suggestion you gave me , it doesn´t run. I have put the correct names
but I think that the problem is that the report is based in a query with
parameters. This query has two parameters that the user put via input, to
filter the result, this two parameters are called 'number1' and 'sheet1'.

This two parameters are used also in the form as field text to obtain the
rows result ina a subform. Then in order to obtain, the same result in a
report, I try to put in WHERE condition :

[Name of the report field1]=[Forms]![FormName]![Name of the form field1] AND
[Name of the report field2]=[Forms]![FormName]![Name of the form field2]

But with no result, because it appears to me 2 text boxs asking about these
two field values. I think it is because the report is based in a query that
has two parameterized variables. And then Access gets confused, but I am sure
that I has to have a correct way to run this.

I would be very grateful if anybody could help me to solve this issue.

Regards.
Back to top
Login to vote
Marshall Barton

External


Since: Dec 07, 2003
Posts: 1697



(Msg. 4) Posted: Tue Oct 13, 2009 9:38 am
Post subject: Re: Show a report filtered by text fields of a form [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Jose Garcia wrote:

>"Marshall Barton" wrote:
>> You need to replace the generic names with the real report,
>> field, form and control names. The names must be spelled
>> correctly.
>>
>>
>The suggestion you gave me , it doesn´t run. I have put the correct names
>but I think that the problem is that the report is based in a query with
>parameters. This query has two parameters that the user put via input, to
>filter the result, this two parameters are called 'number1' and 'sheet1'.
>
>This two parameters are used also in the form as field text to obtain the
>rows result ina a subform. Then in order to obtain, the same result in a
>report, I try to put in WHERE condition :
>
>[Name of the report field1]=[Forms]![FormName]![Name of the form field1] AND
>[Name of the report field2]=[Forms]![FormName]![Name of the form field2]
>
>But with no result, because it appears to me 2 text boxs asking about these
>two field values. I think it is because the report is based in a query that
>has two parameterized variables. And then Access gets confused, but I am sure
>that I has to have a correct way to run this.


If the form text boxes [Name of the form field1] and
[Name of the form field2] have the parameter values, then
the query parameters should be:
[Forms]![FormName]![Name of the form field1]
and
[Forms]![FormName]![Name of the form field2]

If you are using the OpenReport method's WhereCondition
argument to filter the report, then post a Copy/Paste of the
code that opens the report so I can see what you are doing.

If you would explain the real form, field and control names,
we could avoid the confusion of all these made up names.

--
Marsh
MVP [MS Access]
Back to top
Login to vote
Jose Garcia

External


Since: Oct 08, 2009
Posts: 3



(Msg. 5) Posted: Tue Oct 13, 2009 9:38 am
Post subject: Re: Show a report filtered by text fields of a form [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

>
> If the form text boxes [Name of the form field1] and
> [Name of the form field2] have the parameter values, then
> the query parameters should be:
> [Forms]![FormName]![Name of the form field1]
> and
> [Forms]![FormName]![Name of the form field2]
>
> If you are using the OpenReport method's WhereCondition
> argument to filter the report, then post a Copy/Paste of the
> code that opens the report so I can see what you are doing.
>
> If you would explain the real form, field and control names,
> we could avoid the confusion of all these made up names.
>
> --
> Marsh
> MVP [MS Access]
>

Hi again,


I have a Query (called 'vigente') its SQL code is:

SELECT TOP 1 Plano.Fecha, Plano.Designacion, Plano.Descripcion,
Plano.Numero, Plano.Hoja, Plano.Revision, Plano.Fecha_ult_revision
FROM Plano
WHERE (((Plano.Numero)=[number2]) AND ((Plano.Hoja)=[hoja2]))
ORDER BY Plano.Revision DESC;


I have a Form (called 'buscar') with two field texts to filter the rows, the
result is shown in a subform based in the field texts mentioned before.

In this form there is a button, that by event runs a Macro , this Macro
executes the 'OpenReport' command, the WHERE condition is:

[Numero]=[Formularios]![buscar]![number2] Y
[Hoja]=[Formularios]![buscar]![hoja2]

Where [Numero] and [Hoja] are report text fields of 'InformeVigente' report

But as I have said you it doesn't run properly.

Regards
Back to top
Login to vote
Marshall Barton

External


Since: Dec 07, 2003
Posts: 1697



(Msg. 6) Posted: Tue Oct 13, 2009 11:21 am
Post subject: Re: Show a report filtered by text fields of a form [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Jose Garcia wrote:

>>
>> If the form text boxes [Name of the form field1] and
>> [Name of the form field2] have the parameter values, then
>> the query parameters should be:
>> [Forms]![FormName]![Name of the form field1]
>> and
>> [Forms]![FormName]![Name of the form field2]
>>
>> If you are using the OpenReport method's WhereCondition
>> argument to filter the report, then post a Copy/Paste of the
>> code that opens the report so I can see what you are doing.
>>
>> If you would explain the real form, field and control names,
>> we could avoid the confusion of all these made up names.
>>
>> --
>> Marsh
>> MVP [MS Access]
>>
>
>Hi again,
>
>
>I have a Query (called 'vigente') its SQL code is:
>
>SELECT TOP 1 Plano.Fecha, Plano.Designacion, Plano.Descripcion,
>Plano.Numero, Plano.Hoja, Plano.Revision, Plano.Fecha_ult_revision
>FROM Plano
>WHERE (((Plano.Numero)=[number2]) AND ((Plano.Hoja)=[hoja2]))
>ORDER BY Plano.Revision DESC;
>
>
>I have a Form (called 'buscar') with two field texts to filter the rows, the
>result is shown in a subform based in the field texts mentioned before.
>
>In this form there is a button, that by event runs a Macro , this Macro
>executes the 'OpenReport' command, the WHERE condition is:
>
>[Numero]=[Formularios]![buscar]![number2] Y
>[Hoja]=[Formularios]![buscar]![hoja2]
>
>Where [Numero] and [Hoja] are report text fields of 'InformeVigente' report


You want the same fields to use bith a prompt parameter in
the query and the OpenReport's WhereCondition.

I think you should get rid to the criteria in the query and
use just the WhereCondition.

I don't use macros so I can't be sure, but if Numero and
Hoja are Text fields in the table, I think the
WhereCondition should be more like:

Numero=" '" & Formularios!buscar!number2 & "' Y Hoja='" &
Formularios!buscar!hoja2 & "' "

What you had would be the way to do it if both fields in the
table are number types.

--
Marsh
MVP [MS Access]
Back to top
Login to vote
Display posts from previous:   
       Home -> Office other -> Reports All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
 Office
  Office Other
 Security
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET |
  • IT Support