Parameter form/report trouble

A

allie357

I have a form with 2 dependent combo boxes (the second it dependent on
the first) and 3 text fields (2 for date and 1 for a number parameter).
Anyway, I originally was trying to use a filter to get the desired
result but parameters work better.

So I wrote a new query and redesigned the report. Now when I run the
query that the report references separately everything works fine. But
when I try to use the form to generate the report or try to test it in
print preview of the report I get no results. I have tried adding a
preview report button but it does not return any results. I don't
understand why the report is not picking up the query results.

Here is the queries:

This is the first query that contains the parameters:

SELECT tbl_Violators![ViolatorLast Name] & ", " &
tbl_Violators!ViolatorFirstName AS ViolatorName,
Count(tbl_Policies.Policy) AS CountOfPolicy, tblDepartments.RCName,
tblDepartments.DeptName
FROM tbl_Violators INNER JOIN (tbl_Policies INNER JOIN (tbl_Violations
LEFT JOIN tblDepartments ON tbl_Violations.ViolatorsDepartmentNumber =
tblDepartments.DeptNumber) ON tbl_Policies.Policy_ID =
tbl_Violations.Policy_ID) ON tbl_Violators.Violator_ID =
tbl_Violations.Violator_ID
WHERE (((tbl_Violations.DateEntered) Between
[Forms]![XViolationsForm]![txtStartDate] And
[Forms]![XViolationsForm]![txtEndDate]))
GROUP BY tbl_Violators![ViolatorLast Name] & ", " &
tbl_Violators!ViolatorFirstName, tblDepartments.RCName,
tblDepartments.DeptName
HAVING
(((Count(tbl_Policies.Policy))>=[Forms]![XViolationsForm]![txtNumber])
AND ((tblDepartments.RCName)=[Forms]![XViolationsForm]![CboRCName]) AND
((tblDepartments.DeptName)=[Forms]![XViolationsForm]![cboDeptName]))
ORDER BY tbl_Violators![ViolatorLast Name] & ", " &
tbl_Violators!ViolatorFirstName, Count(tbl_Policies.Policy) DESC;

This is the second query where the first query is joined with another
to produce the report results:
--------------------------------------------------------------------------------

SELECT [Number of Times2].ViolatorName, [Number of
Times2].CountOfPolicy, [Number of Times2].RCName, [Number of
Times2].DeptName, qry_Number_of_Violations_details.CountOfPolicy AS
[Violation Count], qry_Number_of_Violations_details.Policy,
qry_Number_of_Violations_details.Amount,
qry_Number_of_Violations_details.Description,
qry_Number_of_Violations_details.DateEnteredFROM [Number of Times2]
INNER JOIN qry_Number_of_Violations_details ON [Number of
Times2].ViolatorName =
qry_Number_of_Violations_details.ViolatorNameWHERE ((([Number of
Times2].CountOfPolicy)>=[Forms]![XViolationsForm]![txtNumber]) AND
(([Number of Times2].RCName)=[Forms]![XViolationsForm]![CboRCName]) AND
(([Number of Times2].DeptName)=[Forms]![XViolationsForm]![cboDeptName])
AND ((qry_Number_of_Violations_details.DateEntered) Between
[Forms]![XViolationsForm]![txtStartDate] And
[Forms]![XViolationsForm]![txtEndDate]))WITH OWNERACCESS OPTION;
 

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