Change text in a command button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using the following code to allow data entry or editing in a subform.
When I click on the command button, I want the caption on the command button
change but it's not. How can I change this.

Private Sub cmdAddEdit_Click()

If Me.Caption = "Add Assoc." Then

Me.Caption = "Edit Assoc."
sfAssociate.Form.AllowEdits = True
sfAssociate.Form.AllowDeletions = False
sfAssociate.Form.AllowAdditions = False
sfAssociate.Form.DataEntry = False

Else


Me.Caption = "Add Assoc."
sfAssociate.Form.AllowEdits = False
sfAssociate.Form.AllowDeletions = False
sfAssociate.Form.AllowAdditions = True
sfAssociate.Form.DataEntry = True

End If

sfAssociate.Requery

End Sub

Thanks in advance.

Mark
 
The Me applies to the form, you should add the button name
Me.mdAddEdit.Caption = "Edit Assoc."
 
Back
Top