Crosstab problem

H

Harley Feldman

I have built a crosstab query based on another select query below:

Select query:
SELECT InventionDisclosures.DisclosureID, Inventors.InventorLName, Inventors.InventorFName, InventionDisclosures.Code, IIf(IsNull([SubmissionDate]) And Not IsNull([ConceptionDate]),Date()-[ConceptionDate],[SubmissionDate]-[ConceptionDate]) AS SubmissionDays, IIf(Not IsNull([SubmissionDate]) And Not IsNull([ConceptionDate]),1,0) AS CountSubmissionDays, IIf(Not IsNull([ApprovalDate]),1,0) AS Approved, IIf(Not IsNull([RejectionDate]),1,0) AS Rejected, IIf(Not IsNull([ApprovalDate]) And Not IsNull([ProjectRelated]),1,0) AS ProjectApproved, IIf(Not IsNull([RejectionDate] And Not IsNull([ProjectRelated])),1,0) AS ProjectRejected, DisclosureInventors.PrimaryOrSecondary, InventionDisclosures.ApprovalDate
FROM InventionDisclosures INNER JOIN (Inventors INNER JOIN DisclosureInventors ON Inventors.InventorID = DisclosureInventors.InventorID) ON InventionDisclosures.DisclosureID = DisclosureInventors.DisclosureID
GROUP BY InventionDisclosures.DisclosureID, Inventors.InventorLName, Inventors.InventorFName, InventionDisclosures.Code, IIf(IsNull([SubmissionDate]) And Not IsNull([ConceptionDate]),Date()-[ConceptionDate],[SubmissionDate]-[ConceptionDate]), IIf(Not IsNull([SubmissionDate]) And Not IsNull([ConceptionDate]),1,0), IIf(Not IsNull([ApprovalDate]),1,0), IIf(Not IsNull([RejectionDate]),1,0), IIf(Not IsNull([ApprovalDate]) And Not IsNull([ProjectRelated]),1,0), IIf(Not IsNull([RejectionDate] And Not IsNull([ProjectRelated])),1,0), DisclosureInventors.PrimaryOrSecondary, InventionDisclosures.ApprovalDate
HAVING (((DisclosureInventors.PrimaryOrSecondary)="Primary"));

Crosstab query (data from standard cheese:
PARAMETERS [Forms]![Disclosures Report Date Range]![BeginDate] DateTime, [Forms]![Disclosures Report Date Range]![EndDate] DateTime;
TRANSFORM Count(qryInventorCodes.DisclosureID) AS CountOfDisclosureID
SELECT qryInventorCodes.InventorLName AS [Last Name], qryInventorCodes.InventorFName AS FirstName, Count(qryInventorCodes.DisclosureID) AS [Total Of DisclosureID], Sum(qryInventorCodes.SubmissionDays) AS SubmissionDays, Sum(qryInventorCodes.CountSubmissionDays) AS CountSubmissionDays, Sum(qryInventorCodes.Approved) AS Approved, Sum(qryInventorCodes.Rejected) AS Rejected, Sum(qryInventorCodes.ProjectApproved) AS ProjectApproved, Sum(qryInventorCodes.ProjectRejected) AS ProjectRejected
FROM qryInventorCodes
WHERE (((qryInventorCodes.PrimaryOrSecondary)="Primary") AND ((qryInventorCodes.Code)<>5) AND ((qryInventorCodes.ApprovalDate) Between [Forms]![Disclosures Report Date Range]![BeginDate] And [Forms]![Disclosures Report Date Range]![EndDate]))
GROUP BY qryInventorCodes.InventorLName, qryInventorCodes.InventorFName, qryInventorCodes.PrimaryOrSecondary
PIVOT qryInventorCodes.Code;

These queries work fine when called to run as a queryies. However, when I call the Crosstab query from a form (the Disclosures Report Date Range), I get the following message:

The Microsoft Jet database engine does not recognize " as a valid field name or expression.

Since these are date parameters, I have declared them explicitly in the query parameters seen above. If I remove the date parameters from the query, they work fine with the form. How can these queries work in stand-alone mode but fail when called from a report.

Harley
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top