populate blank fields

G

Guest

I have a table with this type of info - I need to populate the Unitprice with
the previous non-blank price - Is there an easy way - self taught Access.

Thanx

Seq ProductID ProductName TXDate UnitPrice Units
50 4 26X36 Garbage Bags 31-Mar-05 $15.55 31
51 4 26X36 Garbage Bags 15-Apr-05 -1
52 4 26X36 Garbage Bags 29-Apr-05 -1
53 4 26X36 Garbage Bags 18-May-05 -2
54 4 26X36 Garbage Bags 27-May-05 -5
55 4 26X36 Garbage Bags 28-Jun-05 -1
56 4 26X36 Garbage Bags 15-Jul-05 -3
57 4 26X36 Garbage Bags 15-Jul-05 -1
58 4 26X36 Garbage Bags 18-Jul-05 -1
59 4 26X36 Garbage Bags 18-Jul-05 -1
60 4 26X36 Garbage Bags 28-Jul-05 -1
61 4 26X36 Garbage Bags 29-Jul-05 -4
62 4 26X36 Garbage Bags 03-Aug-05 $15.51 30
63 4 26X36 Garbage Bags 05-Aug-05 -1
64 4 26X36 Garbage Bags 15-Aug-05 -1
65 4 26X36 Garbage Bags 18-Aug-05 -1
66 4 26X36 Garbage Bags 18-Aug-05 -6
67 4 26X36 Garbage Bags 30-Aug-05 -6
68 4 26X36 Garbage Bags 01-Sep-05 -2
69 4 26X36 Garbage Bags 14-Sep-05 -2
70 4 26X36 Garbage Bags 19-Sep-05 -1
71 4 26X36 Garbage Bags 04-Oct-05 -2
72 4 26X36 Garbage Bags 13-Mar-06 -1
73 4 26X36 Garbage Bags 16-Mar-06 -1
 
J

John Spencer

IF your seq field is sequential then you could try the following untested SQL statement.

UPDATE YourTable
SET UnitPrice =
DLookup("UnitPrice","YourTable","Seq=" & DMax("Seq","YourTable","Seq<" & Seq &
" AND UnitPrice is Not Null"))
WHERE UnitPrice is Null
 

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