Results 1 to 10 of 10
  1. #1
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160

    how to insert up/down arrows in sort button


    Hi,
    I have a toggle button that sorts a column ascending / descending depending on previous sort. Would like to display up / down arrow image instead. No idea where to get the images, or how to toggle between two images in button. I'm using Access 2016
    Any help greatly appreciated.
    Thanks
    David

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,656

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,821
    If a control has a picture property you can embed any of the built in images by clicking on the ellipses (...) in the property sheet. Image control possibly excepted. Can't say for certain as I'm on my phone on the deck enjoying the sun and a wobbly pop or 2.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,992
    Have a look at my Student Target Grade Explorer example app where I've done exactly what you want
    See http://www.mendipdatasystems.co.uk/m...ter/4594454290
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160
    Thanks for making this access db available, I've downloaded it and am trying to understand - the Surname button which toggles the sort asc/desc, I found the onClick event "=GetOrderBy("Surname")". Excuse my ignorance but where/how can I find the rest of the code that makes the sort work?

    Thanks for your help
    David

  6. #6
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160
    OK making progress, found - Private Function GetOrderBy(FldName As String), but how does the up/down arrow get into the Surname button?

  7. #7
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,992
    The up/down images are in the Image Gallery for the app

    Look at the code in GetOrderBy between the two broken lines. It includes this section
    Code:
    
    If strOrderBy Like "*DESC*" Then
       strSortBy = " Reverse sorted by "
       If Me.Controls(NewControlSort).Tag = "S" Then Me.Controls(NewControlSort).Picture = "up"
    Else
       strSortBy = "Sorted by "
       If Me.Controls(NewControlSort).Tag = "S" Then Me.Controls(NewControlSort).Picture = "down"
    End If
    
    The form load event includes this which sets the sort to Surname and so adds the down arrow to cmdSurname
    Code:
    'CR 09/01/2019 - show visual sort by surname
    GetOrderBy ("Surname")
    The code to do this was an enhancement to the example app that was suggested by AWF member Salvatore Fricano
    It was a neat bit of code which works in A2010 or later.

    Hope that helps
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  8. #8
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160
    Hi Colin, really appreciate all your help, nearly have all the pieces - just missing where I can find/download the up/down arrow images.
    Thanks
    David

  9. #9
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,992
    Can't remember where I got those images from.
    There is probably a simple way of exporting images from the image gallery.
    Otherwise lots of free images online you could use e.g. https://www.freeiconspng.com/images/up-arrow-png

    EDIT
    Another alternative would be to import all your database objects into mine so you get the image gallery items.
    Then delete all my database objects-tables, forms etc
    That does seem a bit absurd but it would work.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  10. #10
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160
    Hi Colin, FYI found alt-codes 30 ▲ and 31 ▼

    Thanks
    David

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 03-13-2019, 08:26 AM
  2. sort option button
    By turk in forum Access
    Replies: 9
    Last Post: 03-08-2012, 03:16 PM
  3. Button to Sort by Field
    By tylerg11 in forum Programming
    Replies: 4
    Last Post: 10-20-2011, 02:43 PM
  4. a-z sort for control button
    By darklite in forum Access
    Replies: 7
    Last Post: 05-28-2010, 04:49 AM
  5. Macro Button to Sort Field A-Z
    By rdirosato in forum Access
    Replies: 1
    Last Post: 03-11-2010, 10:32 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums