Solved

Editing using Forms in MS-Access

Posted on 2012-03-30
6
238 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
Independent Software Vendors: 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!

 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

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.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

739 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