Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Adding a Date Range Picker Dialogue Box to MS Access Query

Posted on 2015-01-03
6
Medium Priority
?
1,016 Views
Last Modified: 2015-01-06
Attached is an example table and simple query export. Is it possible to configure a dialogue box that appears when running this query that has a query parameter to enter a date range picker based on the "ServerTime" column in the database table? I need to export data based on weeks or month ranges and I'm not sure where to start to design a UI feature like this.

It would also be great to know if it's possible to design other types of UI query parameter filters in a dialogue box that would appear before running a query, for example check boxes of all know values of "StoreNum2" field.

Thanks for any tips.
ExportByServerTimeDateRange.accdb
0
Comment
Question by:Mark B
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40529430
revise your query to ask for date input

SELECT dbo_04AGSEMQuoteFormProduction.Rid, dbo_04AGSEMQuoteFormProduction.StoreNum2, dbo_04AGSEMQuoteFormProduction.offer, dbo_04AGSEMQuoteFormProduction.ServerTime
FROM dbo_04AGSEMQuoteFormProduction
WHERE (((dbo_04AGSEMQuoteFormProduction.ServerTime)=[Enter Date]));
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1200 total points
ID: 40529433
or better use two entries for start and end date


SELECT dbo_04AGSEMQuoteFormProduction.Rid, dbo_04AGSEMQuoteFormProduction.StoreNum2, dbo_04AGSEMQuoteFormProduction.offer, dbo_04AGSEMQuoteFormProduction.ServerTime
FROM dbo_04AGSEMQuoteFormProduction
WHERE (((dbo_04AGSEMQuoteFormProduction.ServerTime)>=[Enter Start Date]) AND ((dbo_04AGSEMQuoteFormProduction.ServerTime)<=[Enter End Date]));
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40529436
another alternative is to use Form with StartDate and EndDate and listbox to select the StoreNum2

let me know if you want to take this option.
0
10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

 
LVL 39

Assisted Solution

by:PatHartman
PatHartman earned 400 total points
ID: 40529725
I recommend the form solution.  For this specific example, create a form with two unbound text boxes set to date format so the date picker will appear.  Add a button to run the export.  Make sure that you change the Name property of each control to something meaningful such as txtFromDT, txtThruDT, and cmdExport.  A fourth control to hold the export path is useful when you are creating a file.

Then in the click event of cmdExport, run the TransferSpreadsheet method to export the file.  Before the export, validate that both dates are entered and that FromDT is <= ThruDT.  Also confirm that an export path is entered or populate the control with the application's defined default export path if you have one.  This helps users to not loose files that they export.

I attached a partially working sample to show how I control reports in many applications.  It is A2002 format since it doesn't require anything from newer versions.  I created it with A2013 and it requires a reference to the Office xx Object library so unless you have A2013, you will have to fix the reference to make the example functional.  Just open any module in design view.  Click on Tools, then References and fix the missing reference.
ReportParms.zip
0
 
LVL 85

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 400 total points
ID: 40530026
I agree with the form solution. Asking user to key in dates is asking for troubles. I had a client who recently submitted tax information based on an Access report where the developer had required users to key in the dates (via the [Enter Start Date] method). They significantly under-reported their income levels due to a data entry error (the user had entered 10-01-2013 instead of 01-10-2013). A form with a date picker, or with some sort of validation, would have been much easier for the user.

I believe Helen Fedemma has a good Report Builder example. See this question:

http://www.experts-exchange.com/Database/MS_Access/Q_28527405.html
0
 

Author Closing Comment

by:Mark B
ID: 40534421
Rey's solutions is what I used to get this project started. Rey- if you have an example of the listbox option, I would be interested in reviewing.  The other posts about building a form have been helpful to understand what I need to research how to do. I will need to look for some video training on this. Thank You.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
What we learned in Webroot's webinar on multi-vector protection.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question