Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Date Code in a query (Access 2003 )

    Looking for a code I can use in the criteria of a query to limit the records it shows to only the last 6 months from the current day. I think you can use datediff but not real sure how to use it. Any thoughts? Thanks!!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Date Code in a query (Access 2003 )

    Try

    >=DateAdd("m", -6, Date())

    in the criteria line for the relevant date field.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Code in a query (Access 2003 )

    Hans
    Thanks for the help. This works for the most part but when I have any appointment date/time like 06/06/2008 12:00:00 PM it will not show in the query. I also found out that the data in my linked spread sheet is not in date/time format. It's stored as a text field and I can't change the data source. Is the a way to modify the date field to show the records with ending in 12:00:00 PM? Thanks....

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Date Code in a query (Access 2003 )

    Let's say that your text field that contains date strings is named MyField.
    Add a calculated column to your query with the expression

    MyDate: DateValue([MyField])

    or

    MyDate: CDate([MyField])

    You can modify the alias MyDate.
    Clear the Show check box for this column if you don't want to display it.
    Place the condition in this column instead of in the column for MyDate itself.

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Code in a query (Access 2003 )

    This is a question regarding an older post I made. I was wondering is it posible to add a parameter query do the field below. Use a between and statement to search between a date range. Any thoughts? Thanks..

    Field: DateValue([Appointment Date])
    Criteria: currently shows last 3 months data >=DateAdd("m",-3,Date())
    New suggested criteria Between [enter date] and [enter date] Cant get to work....

  6. #6
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Date Code in a query (Access 2003 )

    Try Between [enter start date] and [enter end date]
    Regards
    John



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •