Command Button

R

ruthie

Hello,

I'm trying to create a command button that by default will lock records in
the form, and will only allow edits after it is clicked, to avoid unnecessary
mistakes. In other words all records are locked until the user clicks command
button to edit.

Any help would be much appreciated.

Thanks in advance,
Ruth.
 
D

Dale Fye

Ruthie,

The form has an AllowEdits property. Set this to False in design view

Then, the code behind the cmd_Edit_Lock button can look like:

Private sub cmd_Edit_Lock_Click

if me.cmd_Edit_Lock.Caption = "&Edit" then
me.cmd_Edit_Lock.Caption = "&Lock"
me.AllowEdits = True
else
me.cmd_Edit_Lock.Caption = "&Edit"
me.AllowEdits = False
end if

end sub

HTH
Dale
 
Top