Hmmm... maybe there's a much simpler way.
The ultimate goal is to provide a RefNumber field that is the year, month, and then counts from one up. 20080701, 20080702, 20080703, ..., 20080801, 20080802, 20080803,...,20080901, etc.
I actually got this code from my brother. I expected the SQL...