Abnormal termination

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

Ruskin Hardie

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

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

Top