Passing parameters to report doesn't work

lundi 23 février 2015

I'm read everything I can on this and can't find a solution.



I have a query that sums up the number of parts used.

This works fine.

I want to be able to limit this query to parts used after a specific date.



I have in my report



DoCmd.OpenReport "Part Totals Report", acViewPreview, , "[Part Date])>= " & SQLDate



The report is bound to a query that has

2 group by fields, 1 count field a a further field, a date field ([Part Date], that I put a default criteria on. This field is not displayed. If I don't put a criteria on this field disappears when I close and open again.



I pass a date to the program via a form and this ultimately ends up in SQLDate. When I run this I get promted to enter [Part Date] even though I'm setting it equal to SQLDate above. I can out garbage to a proper date in here either way the report picks up the default date entered in by the query.



I read somewhere on this forum that you

1. Get rid of all of the parameters off the query.



2. Then you can use the Where Clause of the DoCmd.OpenReport code to specify the parameters based on your variables.



1.Not sure what this means but when I get rid of the criteria for the parameter the field disappears (I'm setting the show field to no as I don't want totals group by date). Getting rid of the field gives me all parts used.



2.I think I'm doing this in the above but will bow to superior knowledge!!



or is it I can't pass a parameter to a report run by a query that is grouping fields together to produce a count.



Either way HELP!!





******ADDED*******

Incidentally once the report has been run (albeit with the wrong parameters) and I go into design mode and look at the property sheet for the report the correct filter is there (ie the date that has been input) but it quite clearly ignores this.

Passing parameters to report doesn't work

0 commentaires:

Enregistrer un commentaire

Labels