jazminecat23
Programmer
Hello all -
I have a query I use to populate a subform. This subform lists all charges against a client, by case. Currently, if one case has multiple charges, it lists them each individually. What I would like it to do is this - if there is only one charge on the case, list the chargetype, but if there is more than one charge on the case, put the word "multiple" in the chargetype field. (There is a details form that pops up in a later step to show them all of the charges individually)
Here's my current code for the query:
Here is an example of the current returned results:
NameID CaseID CB/CC# ChargeType
1 1 1234 [green]Disorderly Conduct[/green]
1 1 1234 [green]Assault 4 DV[/green]
1 2 4456 DWLS 3
2 3 9903 Fail to Sign
Here we can see that person 1 has 2 cases - in case 1 there are 2 charges, in case 2 there is one charge.
person 2 has one case (caseid 3) with one charge.
I would like my query results to appear like this instead:
NameID CaseID CB/CC# ChargeType
1 1 1234 [green]"multiple"[/green]
1 2 4456 DWLS 3
2 3 9903 Fail to Sign
I have a query I use to populate a subform. This subform lists all charges against a client, by case. Currently, if one case has multiple charges, it lists them each individually. What I would like it to do is this - if there is only one charge on the case, list the chargetype, but if there is more than one charge on the case, put the word "multiple" in the chargetype field. (There is a details form that pops up in a later step to show them all of the charges individually)
Here's my current code for the query:
Code:
SELECT tblNames.NameID, tblMain.OpenedDate, tblMain.ClosedDate, tblChargeTypes.ChargeType, tblMain.[BAC#], tblCharges.ChargeID, tblMain.[CB/CC#], tblCharges.[Violation Date], tblCharges.[Referral Date], tblCharges.DV, tblCharges.PV, tblCharges.[O/C], tblMain.AttyID, tblMain.CaseID
FROM (tblNames RIGHT JOIN tblMain ON tblNames.NameID = tblMain.NameID) INNER JOIN (tblChargeTypes INNER JOIN tblCharges ON tblChargeTypes.ChargeTypeID = tblCharges.ChargeTypeID) ON tblMain.CaseID = tblCharges.CaseID;
Here is an example of the current returned results:
NameID CaseID CB/CC# ChargeType
1 1 1234 [green]Disorderly Conduct[/green]
1 1 1234 [green]Assault 4 DV[/green]
1 2 4456 DWLS 3
2 3 9903 Fail to Sign
Here we can see that person 1 has 2 cases - in case 1 there are 2 charges, in case 2 there is one charge.
person 2 has one case (caseid 3) with one charge.
I would like my query results to appear like this instead:
NameID CaseID CB/CC# ChargeType
1 1 1234 [green]"multiple"[/green]
1 2 4456 DWLS 3
2 3 9903 Fail to Sign