MS Access Make Forms Have an Icon that Lock and Unlocks Record Editing, MsgBox Confirmation of Record Change

Posted on 2010-01-12
Medium Priority
Last Modified: 2013-11-28

My employees have been changing some of our Database records by mistake.

1. I want to have all Forms load as Read Only, (No Edits), and have them able to press an Icon (perhaps a lock that unlock on click and viceversa) that enables additions

2. Also, I wan t MsgBox to appear that informs then to Confirm the Edits, if they press cancel, the changes are reverted to original values

Is this possible?

Question by:jfer0x01
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
  • 2
LVL 77

Assisted Solution

peter57r earned 400 total points
ID: 26301458
You can prevent edits using the form's Allowedits property.  Set it to No in the form design.

In a button click event procedure you can switch it back to Yes

Me.allowedits = Yes

To confirm changes , use the form's Beforeupdate event procedure.

If msgbox("Save changes) = vbyes then exit sub
Cancel = true

You will need to set the allowedits property to No in the Form_current event procedure just in case it was changed to Yes in the previous record.


Author Comment

ID: 26429616
I tried this, i tweaked the code a bit, to an OkCancel Dialogue Box, where cancel reverts the changes.

I still want a icon to lock, unlock the record.

Can i have actions on images?

Can i do image swapping on click?

LVL 14

Accepted Solution

ldunscombe earned 1600 total points
ID: 30874550
Yes you can but probably the easiest way is to have two images one over the top of the other and simply toggle their visible property on or off.


Create two images one for edit and one for locked  call them imgEdit and imgLocked for arguments sake and layer imgEdit over the top of imgLocked.

in the OnCurrent event of your form put

Me.allowedits = false
me.imgEdit.visible = false

then in the OnClick event of your imgLocked image put
Me.allowedits = true
me.imgEdit.visible = true

PS No Points Wanted.
Peter57 has already posted a solution to your original question.


Author Closing Comment

ID: 31676506
You explained this better though!

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

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…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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 …
Suggested Courses

752 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