Undo in On Error event 
Author Message
 Undo in On Error event

I have a form with two levels of the subforms on the tab controls. When a
user tries to enter data in a subform before creating a record in a parent
form, an error occurs. I want to trap this error in the subform's On Error
event and undo the data entry, but Me.Undo does not work. I set a Response
parameter to 0. May be I have to use another value for this parameter? It is
not described in Help (Access 2002).

Thanks.



Thu, 28 Apr 2005 23:31:00 GMT  
 Undo in On Error event
I use something like this in the subforms Form_BeforeInsert event:

If IsNull(Forms!MainForm!PrimaryKey) Then
    MsgBox "something"
    Cancel = True
End If

In this case the primary key is an autonumber but it ought to work even if
your primary key is not an autonumber

Jan



Quote:
> I have a form with two levels of the subforms on the tab controls. When a
> user tries to enter data in a subform before creating a record in a parent
> form, an error occurs. I want to trap this error in the subform's On Error
> event and undo the data entry, but Me.Undo does not work. I set a Response
> parameter to 0. May be I have to use another value for this parameter? It
is
> not described in Help (Access 2002).

> Thanks.



Sat, 30 Apr 2005 03:43:07 GMT  
 Undo in On Error event
Thank you. Good idea.

Viktor


Quote:
> I use something like this in the subforms Form_BeforeInsert event:

> If IsNull(Forms!MainForm!PrimaryKey) Then
>     MsgBox "something"
>     Cancel = True
> End If

> In this case the primary key is an autonumber but it ought to work even if
> your primary key is not an autonumber

> Jan



> > I have a form with two levels of the subforms on the tab controls. When
a
> > user tries to enter data in a subform before creating a record in a
parent
> > form, an error occurs. I want to trap this error in the subform's On
Error
> > event and undo the data entry, but Me.Undo does not work. I set a
Response
> > parameter to 0. May be I have to use another value for this parameter?
It
> is
> > not described in Help (Access 2002).

> > Thanks.



Sat, 30 Apr 2005 05:53:58 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. help required with Undo butten events

2. Before Event Chage disables Undo

3. How in the &^#$&%#^%@# do you kill or stop or undo a started .AddNew event

4. Selective Undo from the Undo List

5. Bound combo box won't let be cancel/undo, continually generating error messages

6. Undoing On Error Resume Next

7. Undo process when Error occured in COM

8. VB5 Error: Data Error event Hit err: Application or object-defined erro

9. Events, Events, alas, wherefore art thou events...

10. Events, Events, alas, wherefore art thou events...

11. Events, Events, alas, wherefore art thou events...

12. Control Event Problem (Post Event after an event is fired)

 

 
Powered by phpBB® Forum Software