Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 22nd, 2004, 04:04 PM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 137
Thanks: 0
Thanked 0 Times in 0 Posts
Default My UNDO wont UNDO

I have a CANCEL button which locks certain controls and does a few other things. I also wanting to cancel any changes a user makes to a unlocked record. Mu problem is the UNDO method in VBA doesn't undo. Am I doing something wrong?

Private Sub btnCancel_Click()

    ' This is were I am attempting to undo a possible chanhe to a field
    Me.Staff_Forenametxtbox.SetFocus
    Me.Staff_Forenametxtbox.Undo
    Me.Staff_Surnametxtbox.SetFocus


    Me.nextBtn.Enabled = True ' Enable next rec button
    Me.nextBtn.SetFocus

    Me.Staff_Forenametxtbox.Locked = True ' Locked staff forname text box
    Me.Staff_Surnametxtbox.Locked = True ' Locked staff surname text box
    Me.Staff_Servicetxtbox.Locked = True ' Locked service text box
    Me.StaffCheckBox.Locked = True ' Locked Staff checkbox
    Me.VolunteerChexkbox.Locked = True ' Locked Volunteer checkbox
    Me.ACTIVITIES_SUBFORM_FORALL.Locked = True ' Locked users from making amendments to Activity records
    Me.btnSaveRec.Enabled = False ' Disable save button
    Me.btnDelete.Enabled = False ' Disable delete button
    Me.btnAdd.Enabled = True ' Enable add button
    Me.PreRecbtn.Enabled = True ' Enable previous button

    Me.Combo89.Enabled = True ' Enable dropdown surname search
    Me.status_bar.Caption = "CURRENT RECORD LOCKED" ' Change record status text
    Me.unlockBtn.Enabled = True ' Enable unlock button
    Me.btnExtraJobsControl.Enabled = True
    Me.btnCancel.Enabled = False ' Disable cancel button
    DoCmd.GoToRecord , , acFirst ' Return to first record in database


End Sub

Gaz
__________________
Gaz
 
Old March 22nd, 2004, 04:12 PM
Authorized User
 
Join Date: Jun 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I may be way off on this, but if the record is in edit mode. I just issue statement me.undo This will undo any changes to all fields.

Hope this helps,
Mike
 
Old March 22nd, 2004, 08:36 PM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 137
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the tip ! lol i feel so silly I never thought of doing it that way. I guess I should be able to do the same with my sub form on the form

Gaz





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to undo changes to my subform? dstein4d Access VBA 2 October 1st, 2008 11:30 AM
How do i write code to go back or undo sanderson Beginning VB 6 1 July 9th, 2008 05:10 PM
Undo/delete ' (single quote) in a textbox iniro VB.NET 2002/2003 Basics 1 April 6th, 2005 04:41 PM
how to undo the multiple record ??? elleetan Access 6 April 20th, 2004 04:14 AM
Undo string on graphics Dinesh22 VB.NET 2002/2003 Basics 2 January 27th, 2004 12:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.