View Single Post
  #1  
Old April 28th, 2010, 07:43 PM posted to microsoft.public.access.queries
AccessKay
external usenet poster
 
Posts: 106
Default Change expression from month to quarter

I have this expression in a calculated field in my query and it works fine
for the month. I enter the month via a text box on an unbound form. I
thought that if I changed the “m” to a “q” that it would calculate the
quarter based on the date that I supply in my text box. It works if the
month is the first month in the quarter but if it’s like Feb or March, it
returns the wrong amount. Can anyone help me fix this so that it pulls the
correct quarter total?

Qtr_1: Sum(IIf([TransDate] Between ([Forms]![frmVarianceQtr]![txtMo1]) And
DateAdd("q",1,([Forms]![frmVarianceQtr]![txtMo1]))-1,[tblTrans_Mstr].[ODC_Cost],0))

TransDate is in datetime mm/dd/yyyy format

I appreciate any help!