The SQL you posted has none of the modifications that have been suggested to
you. The following should work - have you tried this variation? IF so,
what happens? Error message, no records returned, wrong records returned,
parameter box requesting input?
Parameters [Forms]![frmCustomerSelect]![Text2] Long,
[Forms]![frmCustomerSelect]![Text4] Long;
SELECT tblRMA.Customer, tblRMA.RMA, tblRMA.SalesRep, tblRMA.[WO#-Line#],
tblRMA.[Date Notified], tblRMA.[Discrepant Qty], tblRMA.[U/M],
tblRMA.[Discrepancy Description], tblRMA.[Customer Expectation],
tblRMA.[Discrepancy Code], tblRMA.[Date Disposition Made],
tblRMA.[Disposition Code], tblRMA.[Credit Amount], tblRMA.[Raw Mat'l Cost],
tblRMA.[Labor Cost], tblRMA.[In / Out Frt Cost], tblRMA.[Misc Cost],
tblRMA.DateClosed, [Raw Mat'l Cost]+[Labor Cost]+[In / Out Frt Cost]+[Misc
Cost] AS [Total Cost], Year([Date Notified]) AS YearNum, Month([Date
Notified]) AS MonthNum
FROM tblRMA
WHERE (((tblRMA.Customer)=[Forms]![frmCustomerSelect]![CustomerSelect]) AND
((Year([Date Notified]))=[Forms]![frmCustomerSelect]![Text6]) AND
((Month([Date Notified])) Between [Forms]![frmCustomerSelect]![Text2] And
[Forms]![frmCustomerSelect]![Text4]))
ORDER BY Year([Date Notified]), Month([Date Notified]);
Secret Squirrel said:
Yes the form is opened when I run the query. The form is what triggers the
query. Here is the SQL text of the query;
SELECT tblRMA.Customer, tblRMA.RMA, tblRMA.SalesRep, tblRMA.[WO#-Line#],
tblRMA.[Date Notified], tblRMA.[Discrepant Qty], tblRMA.[U/M],
tblRMA.[Discrepancy Description], tblRMA.[Customer Expectation],
tblRMA.[Discrepancy Code], tblRMA.[Date Disposition Made],
tblRMA.[Disposition Code], tblRMA.[Credit Amount], tblRMA.[Raw Mat'l
Cost],
tblRMA.[Labor Cost], tblRMA.[In / Out Frt Cost], tblRMA.[Misc Cost],
tblRMA.DateClosed, [Raw Mat'l Cost]+[Labor Cost]+[In / Out Frt Cost]+[Misc
Cost] AS [Total Cost], Year([Date Notified]) AS YearNum, Month([Date
Notified]) AS MonthNum
FROM tblRMA
WHERE (((tblRMA.Customer)=[Forms]![frmCustomerSelect]![CustomerSelect])
AND
((Year([Date Notified]))=[Forms]![frmCustomerSelect]![Text6]) AND
((Month([Date Notified])) Between [Forms]![frmCustomerSelect]![Text2] And
[Forms]![frmCustomerSelect]![Text4]))
ORDER BY Year([Date Notified]), Month([Date Notified]);
John Spencer said:
Not really.
Is the form open when you try to run the query?
Can you post the SQL text of your query?
At the beginning of the SQL statement you should have something like:
Parameters [Forms]![frmCustomerSelect]![Text2] Long,
[Forms]![frmCustomerSelect]![Text4] Long;
SELECT ...
FROM ...
WHERE (((tblRMA.Customer)=[Forms]![frmCustomerSelect]![CustomerSelect])
AND
((Year([Date Notified]))=[Forms]![frmCustomerSelect]![Text6]) AND
((Month([Date Notified])) Between [Forms]![frmCustomerSelect]![Text2] And
[Forms]![frmCustomerSelect]![Text4]))
ORDER BY Year([Date Notified]), Month([Date Notified]);
If this prompts you for
[Forms]![frmCustomerSelect]![Text2] and
[Forms]![frmCustomerSelect]![Text4]
then I would suspect that you either have the names of the controls
incorrect or the form is not open.
If this runs without the prompts, but gives you incorrect or no data,
then I
would start looking at the data.
message That didn't work. It still did the same thing. Any other ideas?
:
The parameters you enter are
[Forms]![frmCustomerSelect]![Text2]
and
[Forms]![frmCustomerSelect]![Text4]
Secret Squirrel wrote:
If I was to use the query parameters then it would prompt me to
enter
the
data along with the text boxes. Is there a way around this?
:
I would try forcing the data type.
AND Month([Date Notified]) Between
CLng([Forms]![frmCustomerSelect]![Text2]) And
CLng([Forms]![frmCustomerSelect]![Text4])
You can also set the parameter type either in the SQL Text or by
using the query
grid and selecting parameters from the pop up menu for the query
grid.
Secret Squirrel wrote:
I have a form that is used to enter the parameters for a query.
I
have it set
up with 3 unbound text boxes to enter the starting month number,
the ending
month number, and the year. When I enter a month number greater
than 9 it
won't show any data on the report. But when I enter any starting
and ending
numbers between 1 & 9 the report works fine. Anyone have any
idea
why it
won't work with 10 thru 12? Here is what I have in my query;
WHERE
(((tblRMA.Customer)=[Forms]![frmCustomerSelect]![CustomerSelect])
AND
((Year([Date Notified]))=[Forms]![frmCustomerSelect]![Text6])
AND
((Month([Date Notified])) Between
[Forms]![frmCustomerSelect]![Text2] And
[Forms]![frmCustomerSelect]![Text4]))
ORDER BY Year([Date Notified]), Month([Date Notified]);