Update Blanks Based on Previous Fields

G

Guest

I have a table with the ID as Primary Key. This keeps the records in
"order". The table looks like this:
1 Value
2 Blank
3 Blank
4 Value
5 Blank

I need records 2 and 3 to be updated to the Value in record 1 and record 5
to be updated to the Value in record 4. I read another post of someone that
provided code to do this but I never saw anyone state that it actually
worked. In essence I need all Blank fields in a column to look "up" and find
the next non-blank field and populate itself with that value.
Thanks,
Ted
 
J

John Spencer

The best way to test if code actually works is to back up your data and then
try the code. Otherwise if you want some opinion on whether or not it will
work, post the code and ask.
 
P

Pat Hartman\(MVP\)

Psuedo code would be something like:

open recordset
do until .eof
If IsNull(somefield) Then
update with saved value
Else
save value
End If
.movenext
Loop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top