RE: Replace null value with the previous value?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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.
.



Relevant Pages

  • Re: Filtering "A" An" "The"
    ... Public Function TrimArticle(ByVal strInput As String) As String ... and a query ... ... GlobalSign digital certificate is a forgery and should be deleted without ...
    (microsoft.public.access.forms)
  • Re: combining multiple address fields into 1 address field
    ... Public Function AddrLines(ParamArray adLine()) As String ... understand how I should create a module or how to write the SELECT query. ...
    (comp.databases.ms-access)
  • Re: Datatable
    ... Public Function GetRecordSet(ByVal query As String, ByVal tab As String) As DataTable ... Public Function ExecuteQueryAs DataTable ... Dim myConnection As SqlConnection = New SqlConnection ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Question Re: InStr or other function
    ... Public Function countWords(strToLookIn As String, strToFind As String) ... Unfortunately, my PC crashed and I cannot find the query that I used, so I ...
    (microsoft.public.access.queries)
  • Re: creating a compound iff statement...
    ... >>> Is it possible to create a compound IF Statement in Access Query? ... Switch and (in a public function) Select Case. ... Enter SomeName in the Name box. ... Public Function SomeName(StringIn as string) as String ...
    (microsoft.public.access.queries)