I have a situation where I want to find the first record that has a blank (or null) value (in a certain field), and then copy the value of the record right above it.
Here is a sample type of data file:
Order number Item Number Date Sold
1234 A 05/09/05
1234 B
1234 C
1234 D
5678 A 05/10/05
5678 B
5678 C
5678 D
In this example, I have a file of sales orders. On the first record for a customer order, it has the date of the sale for the first item. For all remaining items sold on that order, the date of sale field is blank (null). I want to be able to find all of the blank dates, and fill in the date from the first record, so that I can report on sales by date for selected items. In this case, I would like the macro to be able to find the first blank (order 1234, Item B), and copy the date from Item A (05/09/05) into the Date Sold field for Item B, then C, then D. Then it would find Order 5678, Item B, and copy the Date Sold (05/10/05) from Item A into the Date Sold field of Item B, then C, etc.
The completed file would look like:
Order number Item Number Date Sold
1234 A 05/09/05
1234 B 05/09/05
1234 C 05/09/05
1234 D 05/09/05
5678 A 05/10/05
5678 B 05/10/05
5678 C 05/10/05
5678 D 05/10/05
I have a Macro in MS Excel that does this, but some of my files are too big to fit into a spreadsheet, so I want to be able to perform the same functionality in Access.
Is there a way to create a macro in Access that would perform this function?
Thanks,
David
Here is a sample type of data file:
Order number Item Number Date Sold
1234 A 05/09/05
1234 B
1234 C
1234 D
5678 A 05/10/05
5678 B
5678 C
5678 D
In this example, I have a file of sales orders. On the first record for a customer order, it has the date of the sale for the first item. For all remaining items sold on that order, the date of sale field is blank (null). I want to be able to find all of the blank dates, and fill in the date from the first record, so that I can report on sales by date for selected items. In this case, I would like the macro to be able to find the first blank (order 1234, Item B), and copy the date from Item A (05/09/05) into the Date Sold field for Item B, then C, then D. Then it would find Order 5678, Item B, and copy the Date Sold (05/10/05) from Item A into the Date Sold field of Item B, then C, etc.
The completed file would look like:
Order number Item Number Date Sold
1234 A 05/09/05
1234 B 05/09/05
1234 C 05/09/05
1234 D 05/09/05
5678 A 05/10/05
5678 B 05/10/05
5678 C 05/10/05
5678 D 05/10/05
I have a Macro in MS Excel that does this, but some of my files are too big to fit into a spreadsheet, so I want to be able to perform the same functionality in Access.
Is there a way to create a macro in Access that would perform this function?
Thanks,
David