• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 600
  • Last Modified:

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

Hi

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?

Jfer
0
jfer0x01
Asked:
jfer0x01
  • 2
2 Solutions
 
peter57rCommented:
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
me.undo
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.






0
 
jfer0x01Author Commented:
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?

Jfer
0
 
ldunscombeCommented:
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.

eg

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.

Leigh
0
 
jfer0x01Author Commented:
You explained this better though!
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now