I just realized the spreadsheet has a ToProject field so I am a little confused by that. If this field does not identify the associated project, what is it for?
Consider revised code:
Code:
For i = 2 To xlRange.Rows.Count
rs.FindFirst "ProjectID=" & Me.ID & " And Years=" & xlRange.Cells(i, 1)
If rs.NoMatch Then
rs.AddNew
rs!projectID = Me.ID
Else
rs.Edit
End If
For j = 1 To xlRange.Columns.Count
rs.Fields(Replace(xlRange.Cells(1, j), " ", "")) = xlRange.Cells(i, j)
Next j
rs.Update
Next i
No Delete action.
However, I am having trouble with the FindFirst method, never been an issue for me before. http://msdn.microsoft.com/en-us/libr...ffice.15).aspx
Change the code to:
Set rs = CurrentDb.OpenRecordset("tblWCCVintage", dbOpenDynaset)