Access Question
        Posted  
        
            by kralco626
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by kralco626
        
        
        
        Published on 2010-05-27T13:01:05Z
        Indexed on 
            2010/05/28
            11:51 UTC
        
        
        Read the original article
        Hit count: 254
        
ms-access
I have a record set for inspections of many peices of equipment. The four cols of interest are equip_id,month,year,myData.
My requirment is to have EXACTLY ONE Record per month for each peice of equipment. I have a quiery that makes the data unique over equip_id,month,year. So there is no more than one record for each month/year for a peice of equipment. But now I need to simulate data for the missing month. I want to simply go back in time to get the last peice of my data.
So that may seem confusing, so i'll show by example.
Given this:
equip_id  month  year  myData
1         1      2010  500
1         2      2010  600
1         5      2010  800
2         2      2010  300
2         4      2010  400
2         6      2010  500
I want this:
equip_id  month  year  myData
1         1      2010  500
1         2      2010  600
1         3      2010  600
1         4      2010  600
1         5      2010  800
2         2      2010  300
2         3      2010  300
2         4      2010  400
2         5      2010  400
2         6      2010  500
Notice that im filling in missing data with the data from the month ( or two months etc.) before. Also note that if the first record for equip 2 is in 2/2010 than I don't need a record for 1/2010 even though I have one for equip 1.
I just need exactly one record for each month/year for each peice of equipment. So if the record does not exsist I just want to go back in time and grab the data for that record.
Thanks!!!
© Stack Overflow or respective owner