Error handling question

J

Jen

In a subform I have

Private Sub Form_Current()
Me.timdebitering_Label.Caption = IIf([AddTax] = 1, "á moms 0%", "á inkl
moms")
End Sub

Works ok, changing the label accordingly, but when I add a new record (in
the main form) I get:

Run-time error '3059':
Operation canceled by user.

If I hit end everything works ok. Tried adding some error handling (I hear
it's a good thing) but I only come up with my own error.

Jen
 
P

Peter De Baets

You may just want to ignore that error when you have a new record. Try this:

On Error Resume Next
Me.timdebitering_Label.Caption = IIf([AddTax] = 1, "á moms 0%", "á inkl
moms")
if err <> 0 then
select case err
case 3059
'* Ignore
case else
msgbox "Error " & err.number & " - " & err.description
end select
err.clear
end if

Hope this helps,
 

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