A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Change button caption on each click



 
 
Thread Tools Display Modes
  #1  
Old March 23rd, 2010, 12:12 AM posted to microsoft.public.access
Song[_4_]
external usenet poster
 
Posts: 43
Default Change button caption on each click

How to change button caption from "Check All" to "Check None" when
clicked, and change back when click again (toggle)? Because of space
limitation, I don't want to create 2 separate buttons.

When click Check All, I update the field to -1
When click Check None, I update the field to 0

Thanks
  #2  
Old March 23rd, 2010, 02:05 AM posted to microsoft.public.access
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Change button caption on each click

Something like this in the button's click event.

With Me.cmdBtnName
If .Caption = "Check All" Then
.Caption = "Check None"
ElseIf .Caption = "Check None" Then
.Caption = "Check All"
End If
End With

Note: replace cmdBtnName with the name for your button.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Song" wrote in message
...
How to change button caption from "Check All" to "Check None" when
clicked, and change back when click again (toggle)? Because of space
limitation, I don't want to create 2 separate buttons.

When click Check All, I update the field to -1
When click Check None, I update the field to 0

Thanks



  #3  
Old March 23rd, 2010, 01:15 PM posted to microsoft.public.access
Song[_4_]
external usenet poster
 
Posts: 43
Default Change button caption on each click

On Mar 22, 7:05*pm, "Jeanette Cunningham"
wrote:
Something like this in the button's click event.

With Me.cmdBtnName
* * If .Caption = "Check All" Then
* * * * .Caption = "Check None"
* * ElseIf .Caption = "Check None" Then
* * * * .Caption = "Check All"
* * End If
End With

Note: replace cmdBtnName with the name for your button.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Song" wrote in message

...



How to change button caption from "Check All" to "Check None" when
clicked, and change back when click again (toggle)? Because of space
limitation, I don't want to create 2 separate buttons.


When click Check All, I update the field to -1
When click Check None, I update the field to 0


Thanks- Hide quoted text -


- Show quoted text -


Thank you, Jeanette. Under what event should I put the code? After
each click, I use docmd.runsql to replace all.
  #4  
Old March 23rd, 2010, 01:49 PM posted to microsoft.public.access
Jon Lewis[_3_]
external usenet poster
 
Posts: 40
Default Change button caption on each click

Or (assuming the field is Boolean):

Private Sub cmdBtnName_Click()
field = Not field
cmdBtnName.Caption = Switch(field, "Check None", Not field, "Check All")
End Sub

Jon



"Jeanette Cunningham" wrote in message
...
Something like this in the button's click event.

With Me.cmdBtnName
If .Caption = "Check All" Then
.Caption = "Check None"
ElseIf .Caption = "Check None" Then
.Caption = "Check All"
End If
End With

Note: replace cmdBtnName with the name for your button.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Song" wrote in message
...
How to change button caption from "Check All" to "Check None" when
clicked, and change back when click again (toggle)? Because of space
limitation, I don't want to create 2 separate buttons.

When click Check All, I update the field to -1
When click Check None, I update the field to 0

Thanks





  #5  
Old March 24th, 2010, 09:54 AM posted to microsoft.public.access
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Change button caption on each click

As I mentioned in the last post, put the code in the on click event for the
button that runs that query.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


"Song" wrote in message
...
On Mar 22, 7:05 pm, "Jeanette Cunningham"
wrote:
Something like this in the button's click event.

With Me.cmdBtnName
If .Caption = "Check All" Then
.Caption = "Check None"
ElseIf .Caption = "Check None" Then
.Caption = "Check All"
End If
End With

Note: replace cmdBtnName with the name for your button.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Song" wrote in message

...



How to change button caption from "Check All" to "Check None" when
clicked, and change back when click again (toggle)? Because of space
limitation, I don't want to create 2 separate buttons.


When click Check All, I update the field to -1
When click Check None, I update the field to 0


Thanks- Hide quoted text -


- Show quoted text -


Thank you, Jeanette. Under what event should I put the code? After
each click, I use docmd.runsql to replace all.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:20 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.