Re: Update fields in previous row from fields in current row
- From: "Tony Girgenti" <tony(nospam)@lakesideos.com>
- Date: Tue, 29 Jan 2008 09:05:49 -0500
Hello Ralph.
After reading up on Bookmarks, i'm still not sure of how to code this
problem. If i do it this way, i get an object required error on the
statement after the If. I can't figure out how to refer to the bookmark's
fields.
Dim rsMark As Variant
casInputFileRecordset.Open
casInputFileRecordset.MoveFirst
rsMark = casInputFileRecordset.Bookmark
Do Until casInputFileRecordset.EOF
If casInputFileRecordset.Fields("CASNumber").Value <> "" Then
rsMark.Fields("CASNumber").Value =
casInputFileRecordset.Fields("CASNumber").Value
End If
casInputFileRecordset.MoveNext
rsMark = casInputFileRecordset.Bookmark
Loop
Thanks,
Tony
"Ralph" <nt_consulting64@xxxxxxxxx> wrote in message
news:OFpDKinYIHA.6140@xxxxxxxxxxxxxxxxxxxxxxx
"Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
news:O1msnRjYIHA.4808@xxxxxxxxxxxxxxxxxxxxxxx
Hello.fields
Developing a VB6, SP6 program using ADO.
If i cycle through a recordset and want to update a previous row with
from the current row, how would i do that? I have the basic logic as you
can see below, i just don't know how to refer to a recordset row that has
already been read.
casInputFileRecordset.Open
casInputFileRecordset.MoveFirst
Do Until casInputFileRecordset.EOF
If casInputFileRecordset.Fields("CASNumber").Value <> "" Then
(previous row) casInputFileRecordset.Fields("CASNumber").Value =
(current row) casInputFileRecordset.Fields("CASNumber").Value
End If
casInputFileRecordset.MoveNext
Loop
Any help would be gratefully appreciated.
Thanks,
Tony
Simply capture the "last" values as you are stepping through the
Recordset.
You might also take a look at "Bookmarks".
http://www.w3schools.com/ado/prop_rs_bookmark.asp
[You have to use either the "adOpenKeyset" or "adOpenStatic" cursor type.]
Capture the Bookmark of the row of interest, then use it to refer to that
record again.
-ralph
.
- Follow-Ups:
- References:
- Update fields in previous row from fields in current row
- From: Tony Girgenti
- Re: Update fields in previous row from fields in current row
- From: Ralph
- Update fields in previous row from fields in current row
- Prev by Date: Re: Update fields in previous row from fields in current row
- Next by Date: Re: Update fields in previous row from fields in current row
- Previous by thread: Re: Update fields in previous row from fields in current row
- Next by thread: Re: Update fields in previous row from fields in current row
- Index(es):
Relevant Pages
|
Loading