Results 1 to 14 of 14
  1. #1
    a2b2c2 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2013
    Posts
    6

    Listing dates without reference to years; displaying only the day

    Good evening experts...

    I am a greenhorn access guy. I developed my own database to keep track of climbing trips. To cut to the chase...
    I am trying to list all the dates of my climbs with no regard for the year...as if the year wasn't even there. So when I sort the list, I will get a long list of dates with no year and no reference to a year. So it would start Jan 1 Jan 1 Jan 3 Jan 3 Jan 4...etc. Those dates could be from different years. I have tried the DatePart and was able to list all the climbs in January for example, however the order still references the year.

    Second question: Is there a way to use a date input and have it only display the day (Monday, Wednesday...etc)? I have tried the choose function, but with no luck.

    Some additional info: I have one table entitled "Climbs"; I have many fields to hold all sorts of climbing data...but also included the date. My key is just the climb # which is determined more when I input a climb and not necessarily the order of climbs. That is determined by the date and time.

    My apologies in advance for the possible confusion in this question. I have researched this on and off for years and can't seem to nail down the procedure, on the assumption there is one. I am not versed in SQL.

    Thank you so much,

    Jim Retemeyer

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    If you do not want to display the year you could probably use the Left() function in aggregate with inStrREv()

    This may give you issues with sorting in order because yhe result will be a string (text). So a better option may be to split the day out with the day() function and the month out with the month() function. Store each value in its own control on a form or in an alias in a query. you could add a third control/alias to concatanate the two back together.

    As for day of the week, you can get an integer value using the Weekday() function. Then you could translate the result using a value list or a table.

    Dim intMyDay As Integer
    intMyDay = Weekday(#12/30/2013#)
    MsgBox intMyDay
    Attached Files Attached Files

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Format(Date(),"dddd")

    will return Monday, Tuesday, etc.

    Refer to Access Help or web for more info on Format function.

    If the order still sorts by year then need to specify different field in query for sorting.
    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.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Forgot about the format option...

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Design tables with full date, record full date, but you can display only Day or Day/Month via Format as June7 has said.

  6. #6
    a2b2c2 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2013
    Posts
    6
    Thank you very much ItsMe. I was able to use your example zip file. The only problem I ran into was that "1" was followed by "10" in both the day and month sort. Am I inputting the date in a certain way that doesn't distinguish between 01 and 1. I don't if I am making myself clear. Your example, in the zip file, sorting of Day/Month with no year works perfectly.

    THank you,

    Jim

  7. #7
    a2b2c2 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2013
    Posts
    6
    Thank you June 7. It works perfectly

    Jim

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I looked at ItsMe's example db. The day and month extract fields sort properly. The NoYear will not sort properly because it is a text value and alpha sort rules. 10 will sort before 2.

    I don't know what you are doing in your db but if the values are text and not numbers, alpha sort will be applied. You can tell if a field is text or number by left or right alignment.
    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.

  9. #9
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    June's explanation in post 8 is the reason I went down the path I did with Day and Month function. It will provide you an opportunity to sort (keeping in mind your rules about extracting month and day). I hope all of this is making sense.

  10. #10
    a2b2c2 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2013
    Posts
    6
    I looked up my design in my table and the Data Type for the Date is Date/Time as in your example. I think it has something to do with how I copied and pasted your query example. Everytime I run the query I get a message, twice, for a parameter "Query1.MyMonth" then "Query1.Date". I hit OK each time and then the query runs...but with the alpha sort...not numeric. I feel I am so close, but missing something simple. I am amazed how easy this seems for you all.

    THanks,

    Jim

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Access query engine is not finding fields named "Query1.MyMonth" and "Query1.Date"

    Post your exact SQL statement for analysis or provide the db. See instructions at bottom of my post.
    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.

  12. #12
    a2b2c2 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2013
    Posts
    6
    Okay...I fixed the parameter problem.
    I also misspoke when I said that your example query sorted the Day/Month perfectly. It is actually doing the same thing that mine does. I have a feeling it has to do with the "/" being inserted in the last column, which, I believe, makes it a alpha sort?

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    No, it would be alpha sort even without the / because the result of the expression is still a string.

    Test this expression:

    NoYear: Format([MyDate],"mm/dd")
    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.

  14. #14
    a2b2c2 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2013
    Posts
    6
    Excellent June 7. It does exactly what I want it to do. Thank you very much.
    I marked thread as solved.

    Jim

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

Similar Threads

  1. Replies: 1
    Last Post: 02-12-2013, 02:33 AM
  2. in between dates pulling all years
    By mejia.j88 in forum Queries
    Replies: 2
    Last Post: 04-25-2012, 10:49 AM
  3. Replies: 3
    Last Post: 03-23-2012, 06:16 AM
  4. Replies: 1
    Last Post: 06-09-2011, 09:15 AM
  5. Populating 10+ Years of Dates Table
    By Mordred in forum Access
    Replies: 2
    Last Post: 04-27-2011, 06:40 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