insert a new record and calculated values

D

Dan

I have my forms calculate a text value when the user moves to the next record
and on open, but when you insert a new record it throws an error. Is there
anyway to get a round this or a better way to have it calculate the text
value rather than with the on current event procedulre. The code for the
calculations is several lines long and involves several if-statements.
 
D

Dirk Goldgar

Dan said:
I have my forms calculate a text value when the user moves to the
next record and on open, but when you insert a new record it throws
an error. Is there anyway to get a round this or a better way to have
it calculate the text value rather than with the on current event
procedulre. The code for the calculations is several lines long and
involves several if-statements.

Why not just have your Current event procedure check for the new record
and act accordingly? You can use the form's NewRecord property to do
this:

If Me.NewRecord Then
' we're on a new record
Else
' we're not.
End If

Or you may be able to revise your calculation code so that it doesn't
give an error when you're on a new record (probably due to Null fields).
To get help with that here, you'd need to post the code and tell us what
error you get, and where.
 
Top