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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top