Abnormal termination

  • Thread starter Thread starter Ann
  • Start date Start date
A

Ann

I have an Access form. When I finished entering data for
a record, I hit enter then it gives error message:

Microsoft Visual C++ Runtime error

Porgram:C:\program files\Microsoft office\Msaccess.exe
abnormal program termination.

I applied office service pack1 , but still has the same
problem.

The last field I entered data has event procedure as
followings, don't know if it cause the problem or other
reason:

Private Sub Difference_AfterUpdate()
Dim curRec As Long
Dim StartValue As Single
Dim curRecs As DAO.Recordset

If Me.NewRecord Then
Me.Recalc
Set curRecs = Me.Recordset
curRecs.MoveFirst
curRecs.MoveNext
curRecs.Edit
StartValue = curRecs("Starting_Balance")
curRecs("Current") = False
curRecs.Update
curRecs.MovePrevious
curRecs.Edit
curRecs("Starting_Balance") = curRecs
("Difference") + StartValue
curRecs("Current") = True
curRecs.Update
End If


Thanks for suggestions.
 
Not sure if this will help, but maybe some error checking needs to be
done... You are taking the current recordset, but are assuming that there is
more than one record (ie; the .MoveFirst then a .MoveNext, what happens if
this record, is the only one entered). Plus, you are not closing and setting
the object to Nothing, ie add;
curRecs.Close
Set curRecs = Nothing

Don't know if this will fix the abnormal program termination error, but it
is always best, to close the objects gracefully (can't hurt to have the code
there).

Another option, is to add a break point somewhere in the code, then step
through and find out which line of code, the application is having issues
with..
 
Back
Top