Use ADO to add or update date in Access
Thanks for the quick reply. I've been reading through the MSN database to
try and figure out the best way to do the search. I believe where I'm
having the problem is I can't determine what the find function returns,
this is what I believe the code should look like...But it is not working,
all of the fields on the MSN website list as optional, so I'm at a bit of
a loss.
If ActiveSheet.Name = "Sr Developer" Then
Do While Len(Range("A" & r).Formula) 0
' repeat until first empty cell in column A
If rs.Find(Range("A" & r).Value) = False Then
With rs
.AddNew ' create a new record
' add values to each field in the record
.Fields("RACFID") = Range("A" & r).Value
.Fields("Employee_Type") = "Senior_Developer"
.Fields(Range("C1").Value) = Range("C" & r).Value
.Fields(Range("D1").Value) = Range("D" & r).Value
.Fields(Range("E1").Value) = Range("E" & r).Value
.Update
' add more fields if necessary...
End With
r = r + 1 ' next row
Loop
Else
With rs
.Update ' create a new record
' add values to each field in the record
.Fields("RACFID") = Range("A" & r).Value
.Fields("Employee_Type") = "Senior_Developer"
.Fields(Range("C1").Value) = Range("C" & r).Value
.Fields(Range("D1").Value) = Range("D" & r).Value
.Fields(Range("E1").Value) = Range("E" & r).Value
.Update
' add more fields if necessary...
End With
r = r + 1 ' next row
Loop
End If
|