Solved

OldValue

Posted on 2004-08-27
4
578 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

630 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