Solved

Adding a Date Range Picker Dialogue Box to MS Access Query

Posted on 2015-01-03
6
783 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 119

Expert Comment

by:Rey Obrero
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 119

Accepted Solution

by:
Rey Obrero 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 119

Expert Comment

by:Rey Obrero
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 34

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
using web browser with BING 40 89
Aceess 2016 - Variable Data Fields? 12 46
Access 2016 Merge Tables 8 29
putting an icon in a form 13 21
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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 …

746 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now