Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

OldValue

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

722 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