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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I fill blank cells in my table with the value of the cell above?

Status
Not open for further replies.

ovie52

Technical User
Feb 5, 2002
11
0
0
GB
I have a table that i have exported into an access database.

Many of the cells are blank. I want these cells to have the same value as the nearest non-blank cell above them.

e.g.

england;london
spain;madrid
germany;berlin
america;newyork
;washington
;dallas

would become:

england;london
spain;madrid
germany;berlin
america;newyork
america;washington
america;dallas

 

If you have only a few records where this occurs, you can do a Ctrl+' in the blank field and the field will be filled with the value from the record above. When you have a lot of records this becomes an unworkable solution and you have to do a little programming to address it.

Regards,
GGleason
 

Does the table have an identity column or unique numeric column? Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
i tried ctrl+ but tyhis just moved the cursor to the btm of the table, it didn't 'autofill' any values.

In answer to tlbroadbent (MIS), i can add these fields in a query and then try to fill the blanks there.

I do have a lot of records and so need to perform the programming as mentioned. The problem is, i have no idea how to do this as my programming is very limited.
 
I would probably do this through code. Open a recordset with the table sorted the way you want. Get the value from the field and store it into a temp variable. Move to the next record and compare the field to the variable. If it is blank update and save the record. If it has a value that is different from the variable, change the variable to the new value. Continue looping through the whole database.

I know this is only pseudo code steps, but I don't have time to write the whole procedure. Hope that helps... Terry M. Hoey
 

ovie52,

Let me clarify the Ctrl+':

That means to hold down the Ctrl key and depress the apostrophe key at the same time. Holding down the Ctrl key and the plus key will take you to the bottom record of your table.

Regards,
GGleason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top