Records with missing data

C

Chase

I have a number of records in a csv file. Where the detail in the first row
is the same as in the second row it is omitted.

How do I code the to replicate the missing date for the previous row?
I get the error (3020 : Update or CancelUpdate without AddNew or Edit) on
the code below

Dim DB As DAO.Database
Dim rst As DAO.Recordset
Set DB = CurrentDb()
Set rst = DB.OpenRecordset("SELECT * From tblTemp2Upload")
Do Until rst.EOF
If IsNull (rst.Fields("QryType")) Then
rst.Fields("QryType") = rst.Fields("QryType")
End If
rst.MoveNext
Loop

Please Help

Chase
 
S

Stefan Hoffmann

hi Chase,
How do I code the to replicate the missing date for the previous row?
Run through your temporary data backwards:

Dim prevDate As Date

rst.MoveLast
prevDate = Now 'or another marker date
Do While Not rst.BOF
If IsNull(rst![Date]) Then
rst.Edit
rst![Date] = prevDate
rst.Update
End If
prevDate = rst![Date]
rst.MovePrevious
Loop
I get the error (3020 : Update or CancelUpdate without AddNew or Edit) on
the code below
The error has nothing to do with your question. Using .Edit and .Update
will fix it.
Do Until rst.EOF
If IsNull (rst.Fields("QryType")) Then rst.Edit
rst.Fields("QryType") = rst.Fields("QryType") rst.Update
End If
rst.MoveNext
Loop


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Error '3061' 2
no duplicate record 6
Form - Do Loop will not execte - 5
Coding to make AddItem work for 2000 6
Strip Characters 2
What am I missing?! 2
findfirst problem 11
Trying to ApplyFilter to form 3

Top