Creating a Command Button

Y

Yecenia

Hello, I need to create a form that shows information in a read only
fashion. However, I need a command button that allows the form to be edit.

How would you create this command? i know access, but not VBA coding.
Please help.

Thanks!
 
K

KARL DEWEY

Why not set Allow Edits to No and then the command button to change it to
Yes.

You will also need to have On Close set Allow Edits to No.
 
L

Linq Adams via AccessMonster.com

This will set the records to read-only, then allow editing of the current
record when the cmdEditRecord button is clicked. When you move to another
record, the read-only status will be re-instituted.

Private Sub Form_Current()
Me.AllowEdits = False
End Sub

Private Sub cmdEditRecord_Click()
Me.AllowEdits = True
End Sub
 
Y

Yecenia

Changing the setting to not Allow Edit is simple, but how would you create
the button that changes those settings to "yes"?

Would you create a Macro? I am not familiar with VBA coding.
 
Y

Yecenia

I used your suggested code under a command button, but I got an error.

Please excuse lack of VBA skills, but does this command require two command
buttons?

I've been working closely with access since 2006, but I've never needed to
tap into VB or SQL until now. i appreciate your patience.
 
D

Damon Heron

The code "Form_Current" is entered in the VB window for the form's current
event, the other code is for the command button click event...
 

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