Results 1 to 4 of 4
  1. #1
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286

    Prompt User for Date Range when running QUERY

    hello, i have a date column (which also has the time of day included), when the query runs, i want the criteria set up so that it will prompt the user to enter the date range that he or she wants to look up

    i think its something along the lines of thjis in the criteria field:


    between [date range] and [date range]

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You are basically correct but you have to have two different parameter names

    ...BETWEEN [DateFrom] AND [DateTo]


    I typically use an unbound form with two textbox controls and a button. The two textbox controls would be for your dates of the date range. You would use the command button wizard to set up the button such that the query is run when the button is clicked. This way your users never have to guess which query to run.

  3. #3
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286
    how would i do this without creating a form? when the user clicks on the query i just want it to prompt the user on click, then the rest of the query will run to pop a table


    also, would i need two columns then with identical data? one column for date to and a second for date from?

    or does it just require ONE date column? currently i only have one date column called [event date] for example

  4. #4
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    The ...BETWEEN [DateFrom] AND [DateTo] would be the criteria for the event date field. The [DateFrom] and [DateTo] are 2 different parameters.


    The query (in SQL text) would look something like this:

    SELECT field1, field2, etc.
    FROM yourtablename
    WHERE [event date] BETWEEN [DateFrom] AND [DateTo]


    You do not have to use a form, but I suggested it since it might be easier for your users. In general, your users should have have access to your objects (tables, queries etc.) All user interaction should be through forms you provide for them.

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

Similar Threads

  1. Query with multiple date range constraints.
    By younggunnaz69 in forum Queries
    Replies: 2
    Last Post: 12-26-2011, 10:45 AM
  2. Run query by date range
    By ARickert in forum Access
    Replies: 2
    Last Post: 06-23-2011, 10:54 AM
  3. Complicated Query needs some date range help
    By KevinMCB in forum Queries
    Replies: 1
    Last Post: 01-11-2011, 12:25 PM
  4. Date range query from form
    By Steve Barnes in forum Queries
    Replies: 2
    Last Post: 07-29-2010, 07:06 PM
  5. Query for date range from two column?
    By sunny in forum Queries
    Replies: 2
    Last Post: 07-28-2010, 07:12 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