Hi
I have a query with a field that calculates whether a debtor balance has gone over a predefined percentage. This predefined percentage is stored in another table. The expression I use to calculate this field is:
OverDFL:IIf((([TopDebtorBalance]/[GrossAssignLedger])*100)>tblClientDetails!DFL,"Over DFL","")
This expression works fine, and it comes up with either "Over DFL" or "Under DFL" as appropriate.
I now want to base a report on the query, but only for "Over DFL" results. However when I type in "Over DFL" in the criteria field, it returns all results regardless of whether it is over/under.
I should point out that the query is form driven, where the form drives the dates between which the report should be shown.
Can anyone help? Many thanks
Below is the SQL code:
SELECT tblClientDetails.ClientNumber, tblClientDetails.ClientName, tblDebtors.DateOfLedger, tblDebtors.TopDebtor, tblDebtors.TopDebtorBalance, IIf((([TopDebtorBalance]/[GrossAssignLedger])*100)>tblClientDetails!DFL,"Over DFL","") AS OverDFL, [TopDebtorBalance]/[GrossAssignLedger] AS Ledger, tblDebtors.GrossAssignLedger, tblDebtors.InsuredUpTo, tblClientDetails.[PolicyEUK?], tblDebtors.Problem, tblDebtors.AddNotes, tblDebtors.RMComments, tblDebtors.[WebsiteVerify?], tblDebtors.EquifaxLimit, tblDebtors.EukTOPriorMonth, tblDebtors.DateofEquifax
FROM tblClientDetails LEFT JOIN tblDebtors ON tblClientDetails.ClientNumber = tblDebtors.ClientNumber
WHERE (((tblDebtors.DateOfLedger) Between [Forms]![DFLReport]![StartDate] And [Forms]![DFLReport]![EndDate]) AND ((tblClientDetails.[PolicyEUK?])=[Forms]![DFLReport]![cboPolicy]) AND ((IIf((([TopDebtorBalance]/[GrossAssignLedger])*100)>[tblClientDetails]![DFL],"Over DFL",""))="Over DFL")) OR (((tblDebtors.DateOfLedger) Between [Forms]![DFLReport]![StartDate] And [Forms]![DFLReport]![EndDate]) AND (([Forms]![DFLReport]![cboPolicy]) Is Null))
ORDER BY [TopDebtorBalance]/[GrossAssignLedger] DESC;
I have a query with a field that calculates whether a debtor balance has gone over a predefined percentage. This predefined percentage is stored in another table. The expression I use to calculate this field is:
OverDFL:IIf((([TopDebtorBalance]/[GrossAssignLedger])*100)>tblClientDetails!DFL,"Over DFL","")
This expression works fine, and it comes up with either "Over DFL" or "Under DFL" as appropriate.
I now want to base a report on the query, but only for "Over DFL" results. However when I type in "Over DFL" in the criteria field, it returns all results regardless of whether it is over/under.
I should point out that the query is form driven, where the form drives the dates between which the report should be shown.
Can anyone help? Many thanks
Below is the SQL code:
SELECT tblClientDetails.ClientNumber, tblClientDetails.ClientName, tblDebtors.DateOfLedger, tblDebtors.TopDebtor, tblDebtors.TopDebtorBalance, IIf((([TopDebtorBalance]/[GrossAssignLedger])*100)>tblClientDetails!DFL,"Over DFL","") AS OverDFL, [TopDebtorBalance]/[GrossAssignLedger] AS Ledger, tblDebtors.GrossAssignLedger, tblDebtors.InsuredUpTo, tblClientDetails.[PolicyEUK?], tblDebtors.Problem, tblDebtors.AddNotes, tblDebtors.RMComments, tblDebtors.[WebsiteVerify?], tblDebtors.EquifaxLimit, tblDebtors.EukTOPriorMonth, tblDebtors.DateofEquifax
FROM tblClientDetails LEFT JOIN tblDebtors ON tblClientDetails.ClientNumber = tblDebtors.ClientNumber
WHERE (((tblDebtors.DateOfLedger) Between [Forms]![DFLReport]![StartDate] And [Forms]![DFLReport]![EndDate]) AND ((tblClientDetails.[PolicyEUK?])=[Forms]![DFLReport]![cboPolicy]) AND ((IIf((([TopDebtorBalance]/[GrossAssignLedger])*100)>[tblClientDetails]![DFL],"Over DFL",""))="Over DFL")) OR (((tblDebtors.DateOfLedger) Between [Forms]![DFLReport]![StartDate] And [Forms]![DFLReport]![EndDate]) AND (([Forms]![DFLReport]![cboPolicy]) Is Null))
ORDER BY [TopDebtorBalance]/[GrossAssignLedger] DESC;