Dim thisMonth As Integer
DateCollected = DataSet.Repair.Rows(2).Item("DateCollected")
thisMonth = Month(Now)
For........
If Month(DateCollected) = thisMonth Then
partsprofit = (partswholesalerpricetotal) / (partstotalcost) * 100
Else
End If
Next
Basically i am writing up some code that loops through all the records in a table looking at a column called 'Datecollected'.
it checks to see whether the date collected is in the same month as the current month . for example say the date collected is 26/04/2010 and the current date is today(23/04/2010) then datecollected is in the same date where as if the current date was 12/05/2010 it wouldnt.
i am trying to come up with some code that can check the two dates, any advice or help would be appreciated