CMD Button to Change Mode

  • Thread starter Thread starter Ron A.
  • Start date Start date
R

Ron A.

Is it possible to put a command button on a form that when selected will
change the form edit properties from yes to no? If so, could you post an
example?

Thank you.
 
Ron A. said:
Is it possible to put a command button on a form that when selected will
change the form edit properties from yes to no? If so, could you post an
example?


Certainly, *if* the only thing keeping the form from being editable is its
AllowEdits property:

Private Sub cmdEdit_Click()

Me.AllowEdits = True

End Sub

But if the form is not editable for some other reason, like for example if
it's bound to a nonupdatable query, this button will have no effect on the
editablity of the bound controls.
 
Private Sub cmdEdits_Click()

Me.AllowEdits = Not Me.AllowEdits
If Me.AllowEdits Then
Me.cmdEdits.Caption = "Edits On"
Else
Me.cmdEdits.Caption = "Edits Off"
End If
End Sub
 
Thanks guys...perfect.
--
Ron A.


Klatuu said:
Private Sub cmdEdits_Click()

Me.AllowEdits = Not Me.AllowEdits
If Me.AllowEdits Then
Me.cmdEdits.Caption = "Edits On"
Else
Me.cmdEdits.Caption = "Edits Off"
End If
End Sub
 
Could you show me sample expression of clicking once on a command button to
exit data entry and clicking it again to enter data entry. Thank you.
 
The example I posted does exactly that.
The line:
Me.AllowEdits = Not Me.AllowEdits

will make it true if it is false and false if it is true
 
Back
Top