I would like to include in Deposits only those totals that have a media type of 1. (i.e. [E1 Payment Media Number] = 1.) How would I change this code to screen out any other payment media numbers?
' Retrieve the Cash Deposits for each store
sSQL = "SELECT [Store Number],"
sSQL = sSQL & " [Posting Date],"
sSQL = sSQL & " Sum([E1 Payment Media Ttl]+[E2 Payment Media Ttl]+[E3 Payment Media Ttl]+[E4 Payment Media Ttl]+[E5 Payment Media Ttl]+[E6 Payment Media Ttl]+[E7 Payment Media Ttl]+[E8 Payment Media Ttl]) AS Deposits"
sSQL = sSQL & " FROM D_DEP"
sSQL = sSQL & " GROUP BY [Store Number], [Posting Date]"
sSQL = sSQL & " HAVING [Posting Date]= #" & Format(gdPostingDate, "mm/dd/yyyy" & "#;"
Set rs = db.OpenRecordset(sSQL)
Thanks for your help.
' Retrieve the Cash Deposits for each store
sSQL = "SELECT [Store Number],"
sSQL = sSQL & " [Posting Date],"
sSQL = sSQL & " Sum([E1 Payment Media Ttl]+[E2 Payment Media Ttl]+[E3 Payment Media Ttl]+[E4 Payment Media Ttl]+[E5 Payment Media Ttl]+[E6 Payment Media Ttl]+[E7 Payment Media Ttl]+[E8 Payment Media Ttl]) AS Deposits"
sSQL = sSQL & " FROM D_DEP"
sSQL = sSQL & " GROUP BY [Store Number], [Posting Date]"
sSQL = sSQL & " HAVING [Posting Date]= #" & Format(gdPostingDate, "mm/dd/yyyy" & "#;"
Set rs = db.OpenRecordset(sSQL)
Thanks for your help.