Results 1 to 5 of 5
  1. #1
    Symlink is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Mar 2013
    Posts
    42

    Sort by month

    I have a table with product numbers and their cost. That table has 3 fields : SKU, Cost, Month. (The cost can change every month, therefore the list is built to have a cost / month)



    I want the user to be able to input the data in the table using the form but I would like the form to be sorted Alphanumerically for the SKU numbers and then per month (in their normal order not alphanumerically).

    I have a combobox (named month for testing purposes) to force the user to select one of the 12 months and the field type is Text.

    Also I am unsure how to "autosort" (or apply a permanent sort) the form whenever it's opened. Will it be applied if I just set the sort and then restrict the user from seeing let's see design mode?

    Thanks for the help.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The Month field is text and this has month names, not numbers? Need to translate the name to number. Here is one way:

    Month([Month] & "/1/2000")

    Use a query with SORT BY clause as form RecordSource.

    BTW, should not use reserved words as names. Month is a reserved word.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Symlink is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Mar 2013
    Posts
    42
    I tried adding a button to MsgBox(Month([Month] & "/1/2000")) and it gives me an error. I am reading the syntax of the Month() function (here : http://www.techonthenet.com/access/f...date/month.php ) and what I can read is you can only provide the Month() function with a valid numerical date ? Or maybe I missed something. And thanks for the tip about the reserved name

  4. #4
    Symlink is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Mar 2013
    Posts
    42
    Alright sorry for that I got it working. I will work on the Query RecordSource for the form. Thanks alot for your time, it is really appreciated

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I tested the expression before I suggested as it was the first time I thought of it. Glad you got it working.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. sort filter, doesn't sort everything
    By deso in forum Queries
    Replies: 4
    Last Post: 01-25-2013, 05:27 AM
  2. Sort by month then day
    By mrkaye in forum Access
    Replies: 2
    Last Post: 04-23-2012, 09:46 AM
  3. Month sort
    By ali zaib in forum Access
    Replies: 2
    Last Post: 01-23-2012, 11:36 AM
  4. Track capacity changes month by month
    By Nils in forum Database Design
    Replies: 1
    Last Post: 02-18-2011, 03:03 PM
  5. Replies: 5
    Last Post: 11-15-2010, 06:12 PM

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