L
le_s
Please help me with the following code. Every time it runs, it stops halfway
through and gives me a runtime error. The .mdb size goes from <100 MB, to
over 2 GB, which I believe is the source of the problem, but I can't figure
out why since all I'm doing is attempting to fill in blanks in my table (with
fields selected through SQL), with the last nonblank entry above it.
Here's the code:
Sub fillInBlanks()
Dim mySQL As String, lastNonblank As String
mySQL = "SELECT [Dash Data].[Custom Plan 1], [Dash Data].Plan, [Dash
Data].[Custom Demographic 2], [Dash Data].[Time Period], [Dash Data].[Custom
Geographic 1] FROM [Dash Data] ORDER BY [Dash Data].ID;"
Dim RS As Recordset
Set RS = CurrentDb.OpenRecordset(mySQL, dbOpenDynaset)
For i = 0 To RS.Fields.Count - 1
RS.MoveFirst
Do Until RS.EOF
If IsNull(RS(i)) Then
RS.Edit
RS(i) = lastNonblank
RS.Update
Else
lastNonblank = RS(i)
End If
RS.MoveNext
Loop
Next i
End Sub
Thanks!
through and gives me a runtime error. The .mdb size goes from <100 MB, to
over 2 GB, which I believe is the source of the problem, but I can't figure
out why since all I'm doing is attempting to fill in blanks in my table (with
fields selected through SQL), with the last nonblank entry above it.
Here's the code:
Sub fillInBlanks()
Dim mySQL As String, lastNonblank As String
mySQL = "SELECT [Dash Data].[Custom Plan 1], [Dash Data].Plan, [Dash
Data].[Custom Demographic 2], [Dash Data].[Time Period], [Dash Data].[Custom
Geographic 1] FROM [Dash Data] ORDER BY [Dash Data].ID;"
Dim RS As Recordset
Set RS = CurrentDb.OpenRecordset(mySQL, dbOpenDynaset)
For i = 0 To RS.Fields.Count - 1
RS.MoveFirst
Do Until RS.EOF
If IsNull(RS(i)) Then
RS.Edit
RS(i) = lastNonblank
RS.Update
Else
lastNonblank = RS(i)
End If
RS.MoveNext
Loop
Next i
End Sub
Thanks!