Records with missing data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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

no duplicate record 6
Coding to make AddItem work for 2000 12
Error '3061' 2
Add / Update problem 3
Strip Characters 2
findfirst problem 11
What am I missing?! 2
Code error 11

Back
Top