View Full Version : Chart "valid name or expression" problem


Badvoc
09-23-2009, 05:24 AM
I’m trying to create a chart in a report that shows how much time each team in our department spends on a task.
The chart is yearly split into months showing each team in each month.

If I set my query for the chart like this:

SELECT qryMNonEngRptTm.SumOfDuration, qryMNonEngRptTm.Dept, qryMNonEngRptTm.Team, MonthName([Monthofactivities]) AS [Month], qryMNonEngRptTm.monthofactivities, qryMNonEngRptTm.Year
FROM qryMNonEngRptTm
WHERE (((qryMNonEngRptTm.Year)="2009"))
GROUP BY qryMNonEngRptTm.SumOfDuration, qryMNonEngRptTm.Dept, qryMNonEngRptTm.Team, MonthName([Monthofactivities]), qryMNonEngRptTm.monthofactivities, qryMNonEngRptTm.Year
ORDER BY qryMNonEngRptTm.monthofactivities;

The query and report chart work fine, but for only the year specified by WHERE (ie “2009”)
I need to have the user choose which year is shown from the form frm_nonengactrptfrm

So I changed the query to this:

SELECT qryMNonEngRptTm.SumOfDuration, qryMNonEngRptTm.Dept, qryMNonEngRptTm.Team, MonthName([Monthofactivities]) AS [Month], qryMNonEngRptTm.monthofactivities, qryMNonEngRptTm.Year
FROM qryMNonEngRptTm
WHERE (((qryMNonEngRptTm.Year)=[forms]![frm_nonengactrptfrm]![text9]))
GROUP BY qryMNonEngRptTm.SumOfDuration, qryMNonEngRptTm.Dept, qryMNonEngRptTm.Team, MonthName([Monthofactivities]), qryMNonEngRptTm.monthofactivities, qryMNonEngRptTm.Year
ORDER BY qryMNonEngRptTm.monthofactivities;

Text9 is a combobox with a row source type (Value list) with the row source 2008;2009;2010;2011;2012

When I try it this user friendly way the query will ok but the chart in the report will not, I get the error message (The Microsoft Jet database engine does not recognize ‘[forms]![frm_nonengactrptfrm]![text9]’ as a valid name or expression.

How can I get this to work?

Kryst51
09-23-2009, 05:43 AM
Try a dot instead of the bangs. Sometimes the bangs are not liked.

Badvoc
09-23-2009, 05:55 AM
Tried that Kryst51,
the duplicate posts before where down to my network play silly buggers and timing out all the time:)

Kryst51
09-23-2009, 06:08 AM
I figured about the duplicate posts. If it does that again, just know that the post usually happens even if your side doesn't show it. Cooky forum.:p