Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2010
    Posts
    2

    Date range not working

    Hello,

    I am trying to run a query based on a table that has a date field. I want to run the query by a date range. I have entered Between #1/1/2011# And #6/30/2011# and Between [Enter Start Date] And [Enter End Date], then using the above date range, into the criteria of the query and I get all dates in the database, from 1/1/2007 to 09/03/2011. Is there something that would make the date range be ignored by Access?



    Thank you for your help!

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Is your date field being stored as text or date/time.

    If it's being stored as a date and you are hard coding

    Between #firstdate# and #seconddate# and you are getting incorrect results

  3. #3
    Join Date
    Nov 2010
    Posts
    2
    I think that I found the problem. In another field I have a criteria that includes an OR statement. I want that date range and this or that in another field. This seems to confuse Access and I will break this into two different queries.

  4. #4
    cap.zadi is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    hey man,

    just try this way, may can be helpful for u.

    I have used something like this very recently. so i thght this might help you out. Design a form with a couple of text boxes.. for Start date and End date. Then put the following code in the control sources for each of them:

    =[Forms]![yourFormName].[txtStartDate]
    =[Forms]![yourFormName].[txtEndDate]

    When user wants to see reports for other days as well, this will let you give the start date and end date. Make sure you give the same code for the date range in the query criteria that fetches your data. And like Paul already said, you could default them to Date(), so when you dont specify a date range, it returns "today" like you want it to.

    regards

    zee

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    You shouldn't have to create 2 queries to do it.

    What do you want your query to show and what fields are involved in your criteria selection?

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

Similar Threads

  1. Date range Q
    By markjet in forum Queries
    Replies: 13
    Last Post: 07-18-2011, 01:00 PM
  2. Run query by date range
    By ARickert in forum Access
    Replies: 2
    Last Post: 06-23-2011, 10:54 AM
  3. Date range
    By eacollie in forum Queries
    Replies: 7
    Last Post: 06-05-2011, 03:38 PM
  4. Date Range Parameter help!?!?
    By dkstech in forum Access
    Replies: 1
    Last Post: 01-15-2011, 11:05 AM
  5. Date range help!!
    By bananatodd in forum Access
    Replies: 26
    Last Post: 10-18-2010, 01:57 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