Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Date Time Picker and Queries

Posted on 2006-03-30
7
Medium Priority
?
258 Views
Last Modified: 2010-08-11
Hi,

I have developed a DB with a simple query.  The query requires the user to enter two dates then will provide the data that is between the date range entered.  (Between [Start Date] And [End Date])  When I run the query, I get a box that asks me for the starting and ending dates, just as you would expect.  What I would like to do is use the DateTimePicker ActiveX control to select the dates instead of having to type in the date.  Does anyone know how this could be accomplished?  Is this even possible?

Thanks,
Shaun
0
Comment
Question by:sbreen
7 Comments
 
LVL 15

Accepted Solution

by:
jmantha709 earned 2000 total points
ID: 16332540
You will have to creat a new form.

Put your date time picker as StartDate and EndDate on that form.

Put a button on the form to run your query.

In the query the parameters would now look like :
Between Forms!MyForm![Start Date] And Forms!MyForm![End Date]
0
 
LVL 3

Expert Comment

by:gh081410
ID: 16332844
look at this, look at GH081410 anwser
http://www.experts-exchange.com/Databases/MS_Access/Q_21793795.html

By the way, sometime with the between function, you have probleme with the date format. there is a trick to bypass it

try: between clng(format(TheDateFrom,"yyyymmdd")) and clng(format(TheDateTo,"yyyymmdd"))
0
 

Author Comment

by:sbreen
ID: 16333139
Could someone show me sample code for the button to run the query.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 15

Expert Comment

by:jmantha709
ID: 16333171
docmd.openquery "QueryName"
0
 
LVL 19

Expert Comment

by:Richard Daneke
ID: 16333309
Hi sbreen,

jmantha709 is correct.  You need a form to use the ActiveX data picker controls and you need to refer to those dates when you run the report.  The form also needs to be open.

When you present a form for parameters, we often offer several buttons - Print Report, Print Preview, and Cancel.  The button wizards can open the report views and cancel the report, but will not hide your form while the report runs. (A certain distraction to the end user!)

Assuming the form is named frmDatePicker, insert the line Form_frmDatePicker.Visible = False before the visual basic line that opens the report.  You can quickly open the code window when you open event properties on each of your form buttons.

And, in the Report OnClose event, you can add two lines:
Form_frmDatePicker.Visible = True
DoCmd.Close Form_frmDatePicker

These will enable your frmDatePicker to show up on next use and will close the form as well.
 
0
 

Author Comment

by:sbreen
ID: 16333395
Thanks jmantha709 it worked great and I will give you the much deserved points.
0
 
LVL 15

Expert Comment

by:jmantha709
ID: 16333417
Glad I could help !
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

581 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