Stuart McLachlan
stuart at lexacorp.com.pg
Tue Jun 15 17:21:17 CDT 2010
An alternative which many of us use is to create a Static function to store the value
{Forms]![frmReports]![cboMonths] and use that function as the criteria in the query instead.
Something like
Static Function MonthStore(optional months as long = 0) as long
Dim Store as Long
If months > 0 then Store = months
MonthStore = Long
End Function
Then in the code of your form (button on_click or whatever)
...
Monthstore cboMonths
Docmd.Openquery "myCrosstab"
...
--
Stuart
On 15 Jun 2010 at 16:33, Heenan, Lambert wrote:
> The short answer is yes, Jet treats crosstabs slightly differently.
>
> You need to open the query in design view and then from the 'Query'
> menu select 'Parameters'. You will get a little dialog box where you
> have to enter the names of the parameters and the data type.
>
> HTH
>
> Lambert
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bob Heygood
> Sent: Tuesday, June 15, 2010 3:56 PM
> To: 'Access Developers discussion and problem solving'
> Subject: [AccessD] Crosstab uses form criteria not
>
> Hello to the list,
>
> I have a query that uses a couple of references to controls on a form to limit the date range for criteria.
> It works just fine.
>
> When I try to use the same query as a source for a second query (crosstab), Access barfs and says:
> "The Microsoft jet database engine does not recognize '{Forms]![frmReports]![cboMonths]' as a valid field name or expression"
>
> Does not the same jet engine work the same when creating a crosstab?
>
> Thanks in advance,
>
> Bob Heygood
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com