Command Button

G

Guest

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.
 
G

Guest

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

Similar Threads

Command Button 2
Edit Record Command 2
Edit Records 2
Update queries with form (trying to avoid error) 1
"Edit" Command Button 11
synchronizing forms for same record and table 2
Locking Fields 3
Command Button 3

Top