Solved

Adding a Date Range Picker Dialogue Box to MS Access Query

Posted on 2015-01-03
6
868 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
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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 36

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 84

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

821 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