[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Editing using Forms in MS-Access

Posted on 2012-03-30
6
Medium Priority
?
244 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
  • 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
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.

 

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 1600 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

873 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