Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / May 2007

Tip: Looking for answers? Try searching our database.

Is DoCmd. RunCommand acCmdUndo reliable?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jon Lewis - 15 May 2007 15:43 GMT
I've always used something like below as standard practice in the Before
Update event of forms:

Dim Response As Integer
Response = MsgBox("Save record changes - Confirm?", vbYesNoCancel +
vbQuestion)
If Response = vbNo Then
DoCmd.RunCommand acCmdUndo
ElseIf Response = vbCancel Then
Cancel = True
End If

However whilst developing an A2K app with several layers of subforms I've
noticed that occasionally when No is chosen when changes have been made to a
nested subform record, acCmdUndo just doesn't work. Changes are saved.  I
haven't yet been able to figure out exactly what sequence reproduces this
but it is definitely periodically happening.  It may be when first of all
Cancel is chosen and then the Before Update is triggered again with No
chosen.  Anyone noticed this before?

TIA
aaron.kempf@gmail.com - 15 May 2007 18:16 GMT
I don't trust anything like that; I use 'working tables' that are
filtered for a particular SPID or SUSER_SNAME so that it's easy and
scalable and multi-user

Access MDB isn't reliable enough for real world usage

On May 15, 7:43 am, "Jon Lewis" <jon.lewis<nospam>@btinternet.com>
wrote:
> I've always used something like below as standard practice in the Before
> Update event of forms:
[quoted text clipped - 17 lines]
>
> TIA
Arvin Meyer [MVP] - 15 May 2007 19:25 GMT
I use:

    Me.Undo

just because it is simpler, and as such, probably more reliable. The problem
you are experiencing is not your code, it is the existence of the subforms.
As you move to or from a subform, data in the form or subfrom that you are
moving from is saved. Your code yries to block that, but will only succeed
if you also put it in the BeforeUpdate event of all the forms and subforms.
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

> I've always used something like below as standard practice in the Before
> Update event of forms:
[quoted text clipped - 17 lines]
>
> TIA
Jon Lewis - 15 May 2007 23:07 GMT
Good suggestion Arvin.  I suppose Me.Undo is being specific about what you
want to undo.  I'll see if it is more reliable.

Many thanks

Jon
>I use:
>
[quoted text clipped - 27 lines]
>>
>> TIA
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.