Results 1 to 8 of 8
  1. #1
    RachelBedi is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jul 2012
    Posts
    67

    Some Assistance with sorting via VBA code

    Hi There - I have forms currently being sorted by the date of enrollment (ascending) - I have since been asked to add an additional level of prioritization so that if the field "DMNumber" has a value that those should be at the top regardless of what the date of enrollment is.



    Is there any way that I can write an if statement to bring those to the top of my datasheet view in my form?

    Thank you guys!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Does the DMNumber need to be in some order at the top of your datasheet, like numerical? Can you add another field to your table?

  3. #3
    RachelBedi is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jul 2012
    Posts
    67
    I don't need it to sort in any particular way - just if there is a dm number there I need it at the top - I could add a field but I would prefer not to if I don't need to!

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Sort the DMNumber field descending.

  5. #5
    RachelBedi is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jul 2012
    Posts
    67
    well I know I can do that but I still need it to sort by the date of enrollment ascending....

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You can sort on both, just sort on the date first. The query designer can help you here. Move the column to the left that you want sorted first. You can also specify asc/desc in design view and Datasheet view will show you what you will get.

  7. #7
    RachelBedi is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jul 2012
    Posts
    67
    ohhhh...yeah that makes sense.

    Thank you!

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Go ahead and use the Thread Tools at the top of the thread to mark this thread as Solved if it works as you want.

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

Similar Threads

  1. Assistance with SQL syntax.
    By gm_lowery in forum Access
    Replies: 6
    Last Post: 06-27-2012, 12:07 PM
  2. Replies: 11
    Last Post: 01-12-2012, 07:55 PM
  3. dlookup assistance
    By underscore in forum Access
    Replies: 4
    Last Post: 12-28-2011, 06:32 AM
  4. Need Assistance with Forms
    By JDA2005 in forum Forms
    Replies: 5
    Last Post: 06-30-2009, 03:37 PM
  5. Normalization Assistance for Tables Please??
    By webmaniac in forum Database Design
    Replies: 10
    Last Post: 09-02-2006, 05:56 AM

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