Question : Need way to alternate some sort of shading between records each time month changes on a Continous Form

I have a detail form which has a number of records.  These records are for monthly billing purposes.  This particular form is used by the user to easily check for months where multiple contracts have been written for the same monthly billing cycle.  The list will be rows of data such as:

BegDate              EndDate                Price
12/1/2005           12/31/2005           10.050
12/15/2005         12/31/2005             9.950
1/1/2006             1/31/2006             10.000
2/1/2006             2/28/2006             10.100
4/1/2006             4/30/2006             10.750

My quick solution to this problem was to create a field in my source query for the form that simply checked for odd or even months.  I would set the field to -1 if true and 0 if false.  On my form, I simply used Conditional Formatting to check the field for the -1 value.  If set to -1 the field would shade.

This setup worked just as I had planned, except for one issue.  This is demonstrated between Feb and Apr on the data that I have given in my example.  The reasons for this occurance are numerous:  The client waiting one month after contract expiration for renewal, billing department being slow, etc.  The bottom line is that this situation makes my solution unusable.

It would be really nice if within a query I could check the previous or next month for a different month number.  However, as far as I know this would require some code with use of a recordset and cycling through.  More work than I want for this simple setup.  Please help with possible suggestions.

Thanks

Answer : Need way to alternate some sort of shading between records each time month changes on a Continous Form

Hmm, what when two months are missing Leigh ?
I guess another workaround would be to use a separate query "qryYearMonth" like:
select distinct year(begdate)&right("00"&month(begdate),2) as UniqueYearMonth from tableX
Now you can use in the "main query":

select field1, dcount("*","qryYearMonth","UniqueYearMonth <='" & year(begdate)&right("00"&month(begdate),2) & "'") as SequenceField, ...

Now the SequenceField can be used instead of the month to check for odd or even.

Nic;o)
Random Solutions  
 
programming4us programming4us