Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Toggle buttons

Status
Not open for further replies.

samotek

Technical User
May 9, 2005
197
BG
I have two command buttons, CmdNew and CmdOld, where by clicking the first i make the second visible and vice versa for example
Private Sub CmdNew_Click()
Me!CmdOld.Visible = True
End Sub
I want to use only one toggle button instead,with two captions"Old" and "New".
I have difficulties with making the buttons visible and invisible.Also.if i click New, the caption Old must appear and stay until i have clicked it.If i click Old, the caption Old must appear and stay until i click it.

How could i do that ?
 
How are ya samotek . . .

Have a look at the [blue]Caption[/blue] property of the button.
Code:
[blue]   Dim prp As Property
   
   Set prp = Me![CommandButtonName].Properties("Caption")
   
   If prp = "New" Then
      [green]'Code for New[/green]
      prp = "Old"
   Else
      [green]'Code for Old[/green]
      prp = "New"
   End If

   Set prp = Nothing[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top