G
Guest
Hi,
I have the following table:
code Amount
a 10
15
20
b 5
10
which I need to show as follows:
code Amount
a 10
a 15
a 20
b 5
b 10
Basically filling in the null cells below with the value from above.
Currently I am using a module called from a query both codes are below:
Module:
Option Compare Database
Global OldValue As String
Function GetOldValue(NewValue As Variant)
If Not IsNull(NewValue) Then
OldValue = NewValue
End If
GetOldValue = OldValue
End Function
SQL Query:
SELECT GetOldValue(
I have the following table:
code Amount
a 10
15
20
b 5
10
which I need to show as follows:
code Amount
a 10
a 15
a 20
b 5
b 10
Basically filling in the null cells below with the value from above.
Currently I am using a module called from a query both codes are below:
Module:
Option Compare Database
Global OldValue As String
Function GetOldValue(NewValue As Variant)
If Not IsNull(NewValue) Then
OldValue = NewValue
End If
GetOldValue = OldValue
End Function
SQL Query:
SELECT GetOldValue(
Code:
) AS NewCode, Table1.* INTO Table2
FROM Table1;
The problem I am having is that the module is dynamic so the reult is not
always the same. Is there any way of eliminating the chance that the wrong
code will be assigned to the wrong amount?