Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can this be done?

Status
Not open for further replies.

joeythelips

IS-IT--Management
Aug 1, 2001
305
0
0
IE
Hi i have a table with samples of records given below.
What i'm trying to do is where i have a record as in line 4 below, I want to fill in the date field, so it equals the last previous date field that is not null i.e 21-jul-00 in this case.
Can this be done? any code would be appreciated


1 56182 R 20-Jul-00,
1 58122 R 20-Jul-00,
1 56903 R 21-Jul-00,
1 none N





 
Well you first have to get the last date right???
you could use the Right(xxxxx) statement to get the date out then you have to convert it to a "Real Date" using Date Serial

DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
This is not code, just algorithm.

[tt]
Position at first record
Saved_date = NOW
Saved_other = Other_Default_value
Loop
Get data
If need date, This_date = Saved_date
If need other, This_Other = Saved_Other
Saved_date = This_date
Update/process record
Advance to next record
Until done
[/tt]

Since records are small, the performance hit for updating unnecessarily should be minimal. if not, it is easy to enhance to only update when necessary.


Wil Mead
wmead@optonline.net

 
hi joeythelips,

try this code
if rs is the name of the recordset u r using:

dim dt as date
rs.movelast
do while not rs.bof
if isnull(rs("date")) then
rs.moveprevious
else
dt=rs("date") 'copy the date if it is not null
exit do
end if
loop

rs.movelast
rs.edit
rs("date")=dt 'push the copied date into the last rec
rs.update

this code will do what u wanted.please reply if this works.

Rajendra
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top