Undoing in the BeforeUpdate Event

M

Mark A. Sam

Something has changed. I am using AccessXP on an A2K database. I want to
undo a selected on an unbound OptionGroup and getting this error:

'Runtime error 2046': Undo isn't available right now.

Here is the Code:

If [SelectRpt] = 1 Then
MsgBox "The Detail report is not yet formatted!"
Cancel = True
DoCmd.RunCommand acCmdUndo
End If


Me.Undo is ineffective becuase this is an unbound control. I have done this
countless times in the past and have recently encountered this problem. Can
anyone help me resolve it?

God Bless,

Mark A. Sam
 
K

Ken Snell

In which event are you running this code? Normally, Undo is not available
for unbound controls and for unbound forms.

Better approach might be to just set the option group's value to Null (so
long as you're not running this code in the BeforeUpdate event of the option
group, that is).
 
M

Mark A. Sam

Ken,

The code is in the BeforeUpdate event and has always been available for
unbound controls in the past. I have used it many times. Even before
DoCmd.RunCommand was available I used Sendkeys "{Esc}" to do the Undo.
Actually I tried that and it worked, so I'll count my blessing and move on
(not that there are many blessings anymore using Access...lol)

God Bless,

Mark
 
K

Ken Snell

FWIW, I have noted a few times when Undo seemed to not be available when I
expected it to be available. May be a flaky thing, but hope your workaround
keeps working.
 
M

Mark A. Sam

Sendkeys has always done the job, however I refrained from using it years
ago, becuase in some cases, using it caused the numloc to toggle on and off
and other things that I can't recall now.

Thanks Ken.
 

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