I have a module that is creating a Run Time Error.
Code:
Public Sub TrimZeroesPayments()
Dim rec As DAO.Recordset
Dim lngLoop As Long
Dim lngCount As Long
Dim strData As String
Dim strTemp As String
Set rec = CurrentDb.OpenRecordset("TblAllPayments-History")
rec.MoveLast
rec.MoveFirst
lngCount = rec.RecordCount
For lngLoop = 1 To lngCount
strData = rec("Invoice Number")
strTemp = Left(strData, 1)
Do While strTemp = "0"
strData = Mid(strData, 2)
strTemp = Left(strData, 1)
Loop
rec.Edit
rec("Invoice Number") = strData
rec.Update
rec.MoveNext
Next lngLoop
Set rec = Nothing
End Sub
This database has been working for a few months, this is the first of this error to my knowledge. It breaks at the "Rec.Edit" portion of the code.
Any suggestions?