Solved

OldValue

Posted on 2004-08-27
4
561 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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.

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now