I need to read from random access files and write them to access to do analysis on a legacy system's data. I have written the code and all seems to work fine for about a week and then bingo! I start getting run-time error 59 bad record length on a GET statement.
Repairing and compacting the database does not help. The only thing which makes it go away is to create a new database and import all the objects into it. This is very annoying. Has anyone else experienced this type of problem? Code snippet is below:
Dim AuditRec As AuditTrail
Dim RecLength As Long
Dim CostDate As Date
Dim AuditFile As String
CostDate = Me.HotDate
AuditFile = "j:\fokus\daily\" & Format(CostDate, "yy-mm-dd") & ".hst"
RecLength = Len(AuditRec)
Open AuditFile For Random Access Read As #1 Len = RecLength
Do While Not EOF(1)
Get #1, , AuditRec 'This is where it fails
'do the analysis
loop
close #1
Repairing and compacting the database does not help. The only thing which makes it go away is to create a new database and import all the objects into it. This is very annoying. Has anyone else experienced this type of problem? Code snippet is below:
Dim AuditRec As AuditTrail
Dim RecLength As Long
Dim CostDate As Date
Dim AuditFile As String
CostDate = Me.HotDate
AuditFile = "j:\fokus\daily\" & Format(CostDate, "yy-mm-dd") & ".hst"
RecLength = Len(AuditRec)
Open AuditFile For Random Access Read As #1 Len = RecLength
Do While Not EOF(1)
Get #1, , AuditRec 'This is where it fails
'do the analysis
loop
close #1