Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crosstab query with form field criteria

Status
Not open for further replies.

BakeMan

Programmer
Jul 24, 2002
129
US
I am trying to write a crosstab query in Access97 that
will allow me to use form fields as criteria for limiting
the values calculated. I have created a form that has a
drop down box that calculates date ranges based off of
predetermined criteria. What I would like is a way that
the user can select a date rang from this list and press a
button to view the crosstab query. I have tried something
like:

TRANSFORM Count(tblNotebook.Key) AS [The Value]
SELECT tblNotebook.BookScannedBy
FROM tblNotebook
WHERE (((tblNotebook.BookScannedBy) Is Not Null) AND
((tblNotebook.BookScanned)=True) AND
((tblNotebook.BookScannedDate) Between [Forms]!
[frmNotebookScanTOCReport]![txtDate1] And [Forms]!
[frmNotebookScanTOCReport]![txtDate2]))
GROUP BY tblNotebook.BookScannedBy
PIVOT tblNotebook.BookScanned;


but get an error that the jet engine does not recognize my
form fields. I could write the query dynamically in the
VBA code behind the button filling in the dates but then
what? Now that I have the SQL statement, how do I show the
results to the user? Or even better... How can I use the
results on a report. If anyone has any ideas or even
understands my question I would appreciate their help.

Thank you in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top