Results 1 to 2 of 2

Thread: Toggle button

  1. #1
    Join Date
    Oct 2005
    Posts
    23

    Unanswered: Toggle button

    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 ?

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    swap the caption (on toggle or on a regular button):

    private sub oneButton_Click()
    if me.oneButton.caption = "Old" then
    'do
    'the
    'old
    'stuff
    'here
    'and switch the button caption
    me.onebutton.caption = "New"
    else
    'do
    'the
    'new
    'stuff
    'here
    'and switch the button caption
    me.onebutton.caption = "Old"
    endif

    izy
    currently using SS 2008R2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •