Click to See Complete Forum and Search --> : .Absolute Position


Pat S
September 20th, 2001, 10:05 AM
I have a code errors out telling me I have an invalid key. The code it errors on is as follows:

Do While Not rs.EOF

.Add rs.AbsolutePosition + 1, rs!Site_Number, rs!Site_Number
rs.MoveNext
Loop

(it errors at the .ADD rs line)
I can't find any help on the invalid key error. Anyone have any suggestions?
Thanks
Pat

Iouri
September 20th, 2001, 10:38 AM
.Add rs.AbsolutePosition + 1, rs!Site_Number, rs!Site_Number
First of all I never heard about .Add statement (maybe it is my problem). As far as I know only AddNew exists. If youare trying to add a new record you have to consider 2 things
1.AbsolutePosition not always gives you the accurate record number
2. AddNew always add a new record at the end of the recordset

If that is what you are trying to accomplish the syntax is

with rs
.AddNew
!Field1 = ...
!Field2 = ...
.Update
end with

Iouri Boutchkine
iouri@hotsheet.com