Solved

OldValue

Posted on 2004-08-27
4
573 Views
Last Modified: 2012-08-13
Using Access 2002

Is it possible to use the OldValue for a form?

Scenerio:  I have a command button:  "Clear and Cancel All Edits" on a subform.

They want to be able to clear all edits on that subform that they just made and have all the fields go back to their original value.  I have many bound fields on this form, so I really would like to find code that I won't have to list all of them and use the OldValue command.  So I am hoping it can be done with the form in general...or something along those lines...unless someone has a better idea.


0
Comment
Question by:huffine
4 Comments
 
LVL 39

Accepted Solution

by:
stevbe earned 150 total points
ID: 11916235
Me.Undo

will undo all changes on a bound form that have not been saved

Steve
0
 
LVL 12

Expert Comment

by:Sayedaziz
ID: 11916283
or

frmcontrolname = me.frmcontrolname.oldvalue
0
 
LVL 2

Author Comment

by:huffine
ID: 11916308
Oh my gosh, sometimes I just feel like I am brain dead and need to be in another profession...or retire!  Always making life harder than it is!

Thanks so much stevbe!  I really appreciate it!  and not putting the answer and then duh...
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 11916319
From the Access 97 help file:

   Dim ctlC As Control

   ' For each control.
      For Each ctlC in Me.Controls
         If ctlC.ControlType = acTextBox Then
            ' Restore Old Value.
            ctlC.Value = ctlC.OldValue
         End If
   Next ctlC

This resets all textboxes. Steve's Me.Undo is a much better option though.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question