Solved

Adding a Date Range Picker Dialogue Box to MS Access Query

Posted on 2015-01-03
6
954 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 300 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
 Watch the Recording: Learning MySQL 5.7

MySQL 5.7 has a lot of new features. If you've dabbled with an older version of MySQL, it is definitely worth learning.

 
LVL 38

Assisted Solution

by:PatHartman
PatHartman earned 100 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 100 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

632 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