Hi there,
Although I said it worked, I was mistaken. I had something REMed out
that shouldn't have been, making me think it had worked. So I tried
what was suggested:
strSQL =
"[subquery_YTD_Prov_A].[Province]='" _
& me.lstProvince.Value & _
& "' " _
& "AND [subquery_YTD_Prov_A].[Month] >= " _
& getMonth(me.lstMonth2.Value) _
& " AND [subquery_YTD_Prov_A].[Month] <= "
& getMonth(me.lstMonths.Value) _
& " AND [subquery_YTD_Prov_A].[Year] >= " _
& me.txtStartYear _
& " AND [subquery_YTD_Prov_A].[Year] <= "
& me.txtYear
DoCmd.OpenReport "rpt_YTD_By_Province", acViewPreview,
"subquery_YTD_Prov_B", strSQL
...and I still get prompted for parameters (subquery_YTD_Prov_A.Month
and .Year).
Why would it prompt me for those values when it is getting those values
in the code? I tried Val(me.txtYear) but that makes no difference.
What I have is a query (subquery_YTD_Prov_A) that works fine. Every
record returned in that query has a Month, Year, and Province field.
For the query I am doing ON that query, I want to only return the
records of a specific date range (month/year to month/year) for a
specific province. It's worth noting that it does not prompt me for the
province parameter....only the Month and Year.
I have named this second query "subquery_YTD_Prov_B" and if I open the
object directly, it works fine, but with the docmd from code it is not
working fine.
That is what I am trying to do, but I don't understand why I am getting
prompted for parameters still. Thanks again for any assistance.
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!