Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

OldValue

Posted on 2004-08-27
4
Medium Priority
?
582 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 600 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

916 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