Changing Text on Button Question...

K

Kgwill85

Okay, before I lay out the question I am going to give you a little
overview about the form that I am using. My form has 4 buttons on
it. 1 for adding a record, another for finding a record, another for
deleting a record and the last to close the form.

Now for my question, I want to know if there is a way to change the
text on my add button from "Add Record" to "Update Record" after the
find button is clicked and the form is searched.

I want the add button to the the same function all the time. I just
want the text to switch when the find button is clicked. And after
the record is "updated" I want the add button to go back to it's
original text, which is "Add Record".

Thanks in advance.
 
D

Douglas J. Steele

To change the text, use

Me!NameOfButton.Caption = "What you want to see"

In the Click event, you'll need to check what the current caption is so that
you know what you're supposed to be doing.
 
K

Kgwill85

To change the text, use

Me!NameOfButton.Caption = "What you want to see"

In the Click event, you'll need to check what the current caption is so that
you know what you're supposed to be doing.

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)









- Show quoted text -

Okay, I don't have to do something else though? I want my add button
to change when the find button is clicked.
 
F

fredg

Okay, before I lay out the question I am going to give you a little
overview about the form that I am using. My form has 4 buttons on
it. 1 for adding a record, another for finding a record, another for
deleting a record and the last to close the form.

Now for my question, I want to know if there is a way to change the
text on my add button from "Add Record" to "Update Record" after the
find button is clicked and the form is searched.

I want the add button to the the same function all the time. I just
want the text to switch when the find button is clicked. And after
the record is "updated" I want the add button to go back to it's
original text, which is "Add Record".

Thanks in advance.

In the click event code of the Find Button:

CommandName.Caption = "Update Record"

Then, in some event after you have updated the form (perhaps the
form's AfterUpdate event):

CommandName.Caption = "Add Record"
 
K

Kgwill85

In the click event code of the Find Button:

CommandName.Caption = "Update Record"

Then, in some event after you have updated the form (perhaps the
form's AfterUpdate event):

CommandName.Caption = "Add Record"

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail- Hide quoted text -

- Show quoted text -

I understand what you are saying, but I think that I am asking for
something different. I don't want the Find Button's text to change.
I want the Add Button's to. When somebody clicks the Find Button, I
want the Add Button's text to change to "Update" instead of "Add".

What can I do for that to happen? (If that's possible)
 
F

fredg

I understand what you are saying, but I think that I am asking for
something different. I don't want the Find Button's text to change.
I want the Add Button's to. When somebody clicks the Find Button, I
want the Add Button's text to change to "Update" instead of "Add".

What can I do for that to happen? (If that's possible)

That's exactly what I told you to do.
All you need do is change CommandName to whatever the actual name is
of the Add Record command button is. You place the code in the Find
button's click event, as well as in what ever other event updates the
record to re-set the caption.
 
K

KARL DEWEY

I think what is being missed is that not only the label needs to change but
the command the button invokes.
 
K

Kgwill85

That's exactly what I told you to do.
All you need do is change CommandName to whatever the actual name is
of the Add Record command button is. You place the code in the Find
button's click event, as well as in what ever other event updates the
record to re-set the caption.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail- Hide quoted text -

- Show quoted text -


Thanks for the help. I got it to work because of your input.
Appreciate it.
 
Top