Change text in a command button

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
 
G

Guest

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

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