Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / February 2008

Tip: Looking for answers? Try searching our database.

Crosstab query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BMusic - 07 Feb 2008 23:47 GMT
I have a base query (qselDEQExport2_Test) with the following SQL statement

SELECT qselChemDetail_W_Const.autWellChemDetailID,
qselChemDetail_W_Const.autWellChemID, qselChemDetail_W_Const.autConstID,
qselChemDetail_W_Const.txtConstituent,
IIf([ysnNotDetected]=-1,"ND",[sglValue]) AS [Value],
qselChemDetail_W_Const.sglValue, qselChemDetail_W_Const.autUnitID,
qselChemDetail_W_Const.ysnNotDetected
FROM qselChemDetail_W_Const;

All basic stuff, except for the one Iif statement that creates a column
called "Value"

When I try to build the crosstab query, it will not let me use "Value" in
the SQL

TRANSFORM First(qselDEQExport2_Test.Value) AS FirstOfConst
SELECT qselChemDetail_W_Const.autWellChemID
FROM qselChemDetail_W_Const
GROUP BY qselChemDetail_W_Const.autWellChemID
PIVOT qselChemDetail_W_Const.autConstID;

returns the following error
"The Microsoft Jet database engine does not recognize
'qselDEQExport2_Test.Value' as a valid field name or expression.

How can I get around this?

I have set the parameter "Value" to data type "text" in the query parameter
box in the original query "qselDEQExport2_Test"

Thanks much for the help!

Beth
KARL DEWEY - 08 Feb 2008 00:45 GMT
Try using another name for your [Value] - Price, Cost, Cost_Per_Item, etc.
Signature

KARL DEWEY
Build a little - Test a little

> I have a base query (qselDEQExport2_Test) with the following SQL statement
>
[quoted text clipped - 30 lines]
>
> Beth
BMusic - 08 Feb 2008 15:21 GMT
OK, I tried changing [Value] to [ConstValue] and [Const] but still doesn't
work.

Also, just discovered that when I assign the parameter in the Query
Parameter dialog box, it asks for Const (or Value previously).

> Try using another name for your [Value] - Price, Cost, Cost_Per_Item, etc.
>
[quoted text clipped - 32 lines]
> >
> > Beth
John Spencer - 08 Feb 2008 17:08 GMT
Your base query is apparently based on another query -
qselChemDetail_W_Const.

Please post that query and the sql for qselDEQExport2_Test if you have
changed it.

With a crosstab query you MUST declare your parameters and if any other
queries are used in the crosstab their parameters must also be declared.

Open the query in design mode
Select Query: Parameters from the Menu
Fill in the EXACT name of the parameter in column 1
Select the data type of the parameter in column 2

You might try copying the SQL into a new query and see if it works.

Have you turned off AutoCorrect in your database?  It can lead to these type
of problems where Access gets the name of something confused.

Signature

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
.

> OK, I tried changing [Value] to [ConstValue] and [Const] but still doesn't
> work.
[quoted text clipped - 43 lines]
>> >
>> > Beth
BMusic - 08 Feb 2008 17:38 GMT
WOW! I'm a complete idiot! Thanks so much for your comments. You made me see
what was wrong. My crosstab query was referencing two different queries:
qselChemDetail_W_Const and qselDEQExport2_Test. It was only supposed to be
pulling data from qselDEQExport2_Test. Once I resent the SQL in the crosstab
query everything works.

TRANSFORM First(qselDEQExport2_Test.Const) AS FirstOfConst
SELECT qselDEQExport2_Test.autWellChemID
FROM qselDEQExport2_Test
GROUP BY qselDEQExport2_Test.autWellChemID
PIVOT qselDEQExport2_Test.autConstID;

As for setting the parameters, I still can't make that work without causing
it to ask for input from the user, but as long as I pull the data from the
right query, it doesn't seem to object.

Thanks so much for the help! Hopefully this will solve the problem and not
make new ones! :)

> Your base query is apparently based on another query -
> qselChemDetail_W_Const.
[quoted text clipped - 62 lines]
> >> >
> >> > Beth
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.