Results 1 to 6 of 6
  1. #1
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528

    not show today

    Hello guys
    I try to show in the history of the field is distributed on 3 fields
    Used the query but I can not show today
    For example, in the history of the field is 10/31/2008
    Please help
    SELECT Right([Submit_Date],4) AS Submit_Year, Left([Submit_Date],InStr([Submit_Date],"/")-1) AS Submit_Month, MyTable.State, MyTable.Submit_Date
    FROM MyTable
    GROUP BY Right([Submit_Date],4), Left([Submit_Date],InStr([Submit_Date],"/")-1), MyTable.State, MyTable.Submit_Date
    ORDER BY Right([Submit_Date],4), Left([Submit_Date],InStr([Submit_Date],"/")-1);

  2. #2
    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
    Is the field a Date datatype? If so, use Year (Submit_Date) also Month() and Day()

    I'm not really understanding your question. An example may help, if I've guessed incorrectly.

  3. #3
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank orange
    I reached for half the solution, but I'm having trouble with the colon (/) How do I remove these
    This is the expression that you used to date field
    Days: Mid(Trim([Submit_Date]);3;3)
    Click image for larger version. 

Name:	344444.PNG 
Views:	6 
Size:	14.1 KB 
ID:	17795

  4. #4
    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
    Try
    Mid(Submit_Date,4,2)

    I don't know where your data originated, but use Date/Time data type for Dates. It will save you may hours of syntax headaches.

  5. #5
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You didn't answer Orange's question. If your Submit_Date field is a Date datatype, there is no need to use String functions like LEFT, RIGHT, and INSTR. You can simply use the YEAR, MONTH, and DAY functions. Then the issue with the slashes (/) is non-existent.

    If you Submit_Date field is String/Text datatype you can still use the YEAR, MONTH, and DAY functions on it. Just convert the field to a date first using the CDATE function, like this:

    MyYearCalc: YEAR(CDATE([Submit_Date]))
    MyMonthCalc: MONTH(CDATE([Submit_Date]))
    MyDayCalc: DAY(CDATE([Submit_Date]))

  6. #6
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank orange, thanks JoeM
    This is what you're looking for
    MyYearCalc: YEAR(CDATE([Submit_Date]))
    MyMonthCalc: MONTH(CDATE([Submit_Date]))
    MyDayCalc: DAY(CDATE([Submit_Date]))

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

Similar Threads

  1. Replies: 3
    Last Post: 04-19-2014, 02:35 AM
  2. Textbox with today's date
    By iProRyan in forum Forms
    Replies: 5
    Last Post: 12-19-2013, 01:13 PM
  3. Replies: 5
    Last Post: 10-12-2012, 11:00 AM
  4. Show report for today only
    By cooper in forum Reports
    Replies: 6
    Last Post: 09-06-2011, 12:46 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