Undo button

T

Trever B

Hi & Thanks

I am creating 3 buttons on my form

1. Save n' Close
2. Undo
3 Undo n' Close

I have no problem with 1 as it it just close command.

But with 2 & 3 Option i get (When no alteration is attempted)
"the command or Action ins't available right now"
I need to trap for this and do nothing if option 2
or if option 3 just close the form.

Your kind & urgent help is sort.

Regards

Trev
 
O

Ofer

Create error trap to check the error number, it will make it continue to
second line on a certain error number

Sub SubName()
On error goto SUbName_Err:

1. Save n' Close
2. Undo
3. Undo n' Close

SUbName_Exit:
Exit sub

SUbName_Err:
If err = [The error number] then
resume next
else
msgbox error
resume SUbName_Exit
end if

End Sub

To get the error number, put in the error trap
Msgbox Err
That will show you the number, then replace the number with the [The error
number] and remove the msgbox
 
R

RuralGuy

IMHO it would be better to avoid the error that trap it.

If Me.Dirty Then
Me.Undo
End If

Hi & Thanks

I am creating 3 buttons on my form

1. Save n' Close
2. Undo
3 Undo n' Close

I have no problem with 1 as it it just close command.

But with 2 & 3 Option i get (When no alteration is attempted)
"the command or Action ins't available right now"
I need to trap for this and do nothing if option 2
or if option 3 just close the form.

Your kind & urgent help is sort.

Regards

Trev

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 

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