DCount?

  • Thread starter Thread starter bw
  • Start date Start date
B

bw

My SQL Code is as follows:

SELECT tblBillSeats.BankName, tblBillSeats.BPseats, tblBillSeats.Pamt,
tblBillSeats.BTseats, tblBillSeats.Tamt, tblBillSeats.BType
FROM tblBanks INNER JOIN tblBillSeats ON tblBanks.BankName =
tblBillSeats.BankName
GROUP BY tblBillSeats.BankName, tblBillSeats.BPseats, tblBillSeats.Pamt,
tblBillSeats.BTseats, tblBillSeats.Tamt, tblBillSeats.BType;

1. I want to know how many values of BType are True, and how many are
False for each BankName.

2. I want to know how many BTypes there are for each BankName.

While I'm sure DCount is what to use here, I can't get anything to work.

This is giving me a syntax error:

CountTrue: DCount("[BillSeatsID]","[tblBillSeats]","[BType] = True and
[tblBillSeats]![BankName] = " & [tblBillSeats]![BankName])
 
Assuming that BankName field is a text field:

CountTrue: DCount("*","[tblBillSeats]","[BType] = True and
[BankName] = '" & [BankName] & "'")
 
Thank you sir!
I also learned something new from your use of the asterisk.


Ken Snell (MVP) said:
Assuming that BankName field is a text field:

CountTrue: DCount("*","[tblBillSeats]","[BType] = True and
[BankName] = '" & [BankName] & "'")


--

Ken Snell
<MS ACCESS MVP>


bw said:
My SQL Code is as follows:

SELECT tblBillSeats.BankName, tblBillSeats.BPseats, tblBillSeats.Pamt,
tblBillSeats.BTseats, tblBillSeats.Tamt, tblBillSeats.BType
FROM tblBanks INNER JOIN tblBillSeats ON tblBanks.BankName =
tblBillSeats.BankName
GROUP BY tblBillSeats.BankName, tblBillSeats.BPseats, tblBillSeats.Pamt,
tblBillSeats.BTseats, tblBillSeats.Tamt, tblBillSeats.BType;

1. I want to know how many values of BType are True, and how many are
False for each BankName.

2. I want to know how many BTypes there are for each BankName.

While I'm sure DCount is what to use here, I can't get anything to work.

This is giving me a syntax error:

CountTrue: DCount("[BillSeatsID]","[tblBillSeats]","[BType] = True and
[tblBillSeats]![BankName] = " & [tblBillSeats]![BankName])
 
Back
Top