View Full Version : filling a table


amanzimdwini
02-16-2007, 11:10 PM
I have a table with one record that is sometimes filled and sometimes null. I'd like to fill the table "downwards" along the lines

HAVE WANT
a a
null a
null a
b b
null b
c c
d d
null d

Quasi-program:

FillStr="xx" (default)
loop while not EOF
if rst.string="null" then set rst.string=FillStr
else FillStr=rst.string
loop

Now all I need is the exact syntax to do this. Any help would be GREATLY appreciated!

karl

Moniker
02-17-2007, 11:19 PM
That's just an Update query.

UPDATE [Your_Table_Name] SET [Your_Table_Name].[Your_Field_Name]='Your Default Value' WHERE [Your_Table_Name].[Your_Field_Name] Is NULL;

amanzimdwini
02-18-2007, 07:29 PM
That's just an Update query.

UPDATE [Your_Table_Name] SET [Your_Table_Name].[Your_Field_Name]='Your Default Value' WHERE [Your_Table_Name].[Your_Field_Name] Is NULL;

Unfortunately, it is NOT -- I don't want to change ALL null values to the Default, I want to change them to the LAST non-null value. Thus, I do need to loop throught the recordset.
I realized that my post did not come across as expected: I'd like to change something like
A null null B null null C null D E null
to
A A A B B B C C D E E
In other words, the last "non-null" value needs to "trickle down" until there is a new non-null value...:confused:

Thanks for the try,

karl