Results 1 to 4 of 4
  1. #1
    yeleek is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    6

    Custom Query field

    Hi,



    In my DB i have a joint Date/time field. I've created a field in the query which is just performing format shortdate and asking for two parameters [startdate] and [enddate]. This is to extract just the date from the original field, and to set the criteria.

    When however I'm running the query or trying to create reports using this field, and if the results cross the end of one month/the beginning of another I see very strange results such as

    01/06/2012
    02/06/2012
    03/06/2012
    28/05/2012
    29/05/2012
    30/05/2012
    31/05/2012

    I think this is because the field I've created is not being seen as a date/time format and is therefore being handled as text. How can i set the format in the query so this field i've created is treated as a date and the results go 28/05 -> 03/06?

    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You can either put the criteria on a calculated field that uses DateValue() instead of Format(), or you can use the date/time field directly and add a day to the selected end date.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    yeleek is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    6
    Quote Originally Posted by pbaldy View Post
    You can either put the criteria on a calculated field that uses DateValue() instead of Format(), or you can use the date/time field directly and add a day to the selected end date.
    Thank you so much. DaveValue() is working fine, easy when you know how heh?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 05-21-2012, 04:09 PM
  2. Setting Custom Field Format Property Problem
    By Weelmaa in forum Programming
    Replies: 2
    Last Post: 02-25-2012, 05:33 AM
  3. Create Custom box before executing query
    By mailinsiddu in forum Access
    Replies: 1
    Last Post: 01-09-2012, 11:14 AM
  4. Custom Date in Query
    By frdebelo in forum Queries
    Replies: 4
    Last Post: 09-22-2011, 07:01 AM
  5. Replies: 2
    Last Post: 08-05-2010, 09:07 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