DateAdd and Listbox Questions

  • Thread starter Thread starter SmokyMtnzz
  • Start date Start date
S

SmokyMtnzz

Hello,

My first question involves DateAdd. I have in a Query as the
Criteria: [Forms]![Form1]![Combo6] Or
DateAdd("m",-12,[Forms]![Form1]![Combo6]). The dates in Combo6 are
all month end dates. The problem is when choosing a February date and
last year's February date was a leap year. If I choose February 28,
2005, I get February 28, 2004. It should be February 29, 2004. I
need this to work for any date where the -12 date is a leap year. Is
this possible?

My second question is about a multi select listbox. I used Allen
Brown's example at http://allenbrowne.com/ser-50.html. This worked
great. But, how do I get the selected items chosen in the listbox to
show in the header of the report. For example, if I chose Peas, Corn
and Beans in the listbox, in the header of my total sales report I
want the reader to know that these sales represent Peas, Corn and
Beans somehow. Just some kind of simple text showing the criteria.

Thanks for your help.

Sincerely,
SmokyMtnz
 
Hello,

My first question involves DateAdd. I have in a Query as the
Criteria: [Forms]![Form1]![Combo6] Or
DateAdd("m",-12,[Forms]![Form1]![Combo6]). The dates in Combo6 are
all month end dates. The problem is when choosing a February date and
last year's February date was a leap year. If I choose February 28,
2005, I get February 28, 2004. It should be February 29, 2004. I
need this to work for any date where the -12 date is a leap year. Is
this possible?

Try

.... OR DateSerial(Year([Combo6]), Month([Combo6]) - 1, 0)

The zeroth of a month is the last day of the prior month.

My second question is about a multi select listbox. I used Allen
Brown's example at http://allenbrowne.com/ser-50.html. This worked
great. But, how do I get the selected items chosen in the listbox to
show in the header of the report. For example, if I chose Peas, Corn
and Beans in the listbox, in the header of my total sales report I
want the reader to know that these sales represent Peas, Corn and
Beans somehow. Just some kind of simple text showing the criteria.

You'll probably need to set the Control Source of a textbox, or the
Caption property of a label, in the code which parses the listbox.

John W. Vinson[MVP]
 
Back
Top