RE: Replace null value with the previous value?
- From: Klatuu <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 23 Jan 2008 08:24:00 -0800
Create a Public Function in a standard module with a Static variable that
will return the value is receives if it is a good value or returns the value
saved in the Static variable if not:
PublicFunction GetName(varName As Variant) As String
Static strPreviousName As String
If Not IsNull(varName) Then
strPreviousName = varName
End If
GetName = strPreviousName
End Function
Now, in your query, create a calculated field and pass the Name field to it:
GoodName: GetName([NameField])
--
Dave Hargis, Microsoft Access MVP
"Okstate student" wrote:
I have a database that was just imported that has approximately 388000.
records. The problem is that there is information about a person in multiple
different records but the name did not come across with each record. (So I
have 10 records with information for a certain name, but the name only
appears in field 1 of the first record and not the subsequent 9, etc.) I
need to create a query or expression that will fill field 1 with the
preceding value if it is null. This way I will have all the information for
field 1 in a manner that I can link and combine data.
Simply I need to fill field 1 with the previous records information if it is
null.
Any help would be greatly appreciated.
- Follow-Ups:
- Re: Replace null value with the previous value?
- From: Michel Walsh
- Re: Replace null value with the previous value?
- Prev by Date: Beginner's Append Query Problem
- Next by Date: Re: Passing the output of a query to a table
- Previous by thread: Beginner's Append Query Problem
- Next by thread: Re: Replace null value with the previous value?
- Index(es):
Relevant Pages
|