Results 1 to 7 of 7

Thread: picture change

  1. #1
    Join Date
    Apr 2004
    Location
    ny, ny
    Posts
    224

    Unanswered: picture change

    I have two buttons A->Z and Z->A. The latter is invisible first When i click on A->Z , it should do the operation, make it invisible and make Z-> A visible

    so the code I have so far si
    sub sortasc_click()
    sortdesc.visible = false
    do the operation
    sortasc.visible = false
    end sub

    I get an error which says i cant make sortasc_click invisible while it is active

    does any one know to i can solve this

    thank you

  2. #2
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    Are these buttons with the three letter text "A>Z" and "Z<A"?

    if so, you could just change the caption or the picture on the button. Then when the user clicks on the button, find out what the current caption is and run the appropriate code. Will that work?

    jps
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  3. #3
    Join Date
    May 2004
    Posts
    15
    This is more complicated than the previous answer but makes it easier to code the two buttons individually. Add two transparent buttons to the form called command0 and command1. Then use this code:

    Private Sub CommandAtoZ_Click()
    [Insert Commands]
    DoCmd.GoToControl ("Command0")
    Call Command0_Click
    End Sub
    Private Sub Command0_Click()
    CommandAtoZ.Visible = 0
    CommandZtoA.Visible = -1
    End Sub
    Private Sub CommandZtoA_Click()
    [Insert Commands]
    DoCmd.GoToControl ("Command1")
    Call Command1_Click
    End Sub
    Private Sub Command1_Click()
    CommandAtoZ.Visible = -1
    CommandZtoA.Visible = 0
    End Sub

  4. #4
    Join Date
    Apr 2004
    Location
    ny, ny
    Posts
    224
    the A-> Z is actually a picture and not just text
    So I need a way to invisible one and sort and then invisible the other and sort

    thank you

  5. #5
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    Just as you can change the caption of a button with code, you can change the picture also.

    So if you want to the same type of if statement could be used.

    If picture = A to Z then
    sort and change picture
    else
    sort and change picture
    end if
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  6. #6
    Join Date
    Apr 2004
    Location
    ny, ny
    Posts
    224
    how do i change picture

  7. #7
    Join Date
    Apr 2004
    Location
    ny, ny
    Posts
    224
    golde's method works

    thanks

Posting Permissions

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