Solved

Adding a Date Range Picker Dialogue Box to MS Access Query

Posted on 2015-01-03
6
835 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 35

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

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.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

776 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