Solved

Editing using Forms in MS-Access

Posted on 2012-03-30
6
239 Views
Last Modified: 2012-04-02
I have a form that was previously created in Access that uses one of the tables as a record source to display the data for each record and also and enable editing of the data. The form is fine, except that I would prefer the data for the record not be updated right away if the user types in a new value or modifies one of the existing values. This is because sometimes the user might accidentally enter an incorrect value or mistakenly type over an existing value but the changes to the record are effected right away. What I would like to have instead, is a Save button that will save the changes that were made. If the user does not press the button, then whatever changes that were made will not be saved. What is the best way to go about this?
0
Comment
Question by:geeta_m9
[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
  • 3
  • 2
6 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 37789722
what about if the user is entering New Record, do they still have to click the Save button?
0
 

Author Comment

by:geeta_m9
ID: 37790133
It doesn't matter, whichever is easier. They will not be entering new records there. The entries will be imported from a spreadsheet using a separate option.
0
 
LVL 20

Expert Comment

by:clarkscott
ID: 37790689
On a "single record" form....

Remove all the 'bound' fields from the CONTROL SOURCE properties of all boxes.
When the user wants to view a record, retrieve the record in code and populate the values in the unbound text boxes on the form.
The user can then change, add, do whatever they want..... but code in the SAVE BUTTON will either locate the record, or create a new record, and populate the recordset from the code.

or

In the Before Update event of the form, add a message box that prompts the user to SAVE or NOT.  If they say NO.... use the sendkeys escape (twice) to reset the record back to original and move on.

Scott C
0
Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 

Author Comment

by:geeta_m9
ID: 37791006
Thanks. I might go with the second option, but where could I find a good resource if I had to write the code for it?
0
 
LVL 20

Accepted Solution

by:
clarkscott earned 400 total points
ID: 37791180
Here you go:

In the FORM - before update event.


Private Sub Form_BeforeUpdate(Cancel As Integer)

if msgbox("Save Changes",vbyesno) = vbno then
     cancel = true
     me.undo
end if

end Sub

Scott C
0
 

Author Comment

by:geeta_m9
ID: 37798251
It works like a charm! Thank you!
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…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

717 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