Solved

Creating a parameter query in Access that prompts for dates?

Posted on 2013-11-25
5
228 Views
Last Modified: 2013-12-18
Hi Folks
Just wondering how I would create a parameter query in Access that prompts for a month rather than a specific string? Thanks.
0
Comment
Question by:agwalsh
[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
  • 2
  • 2
5 Comments
 
LVL 85

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 250 total points
ID: 39674197
I'm not a big fan of "prompting" queries. You would be much better served to create a small form where your users enter the values and you pass those along to the Form or Report you're trying to use with that query.

If you must, however, then do something like this in the Criteria row of your query:

[Enter Closing Date:]

And access will show the user the Inputbox with "Enter Closing Date:". Of course, you have no control over the format of what the user enters, so if they put in "spot" then Access will throw a nasty error.

See this MSDN article for more information: http://office.microsoft.com/en-us/access-help/use-parameters-to-ask-for-input-when-running-a-query-HA102809759.aspx
0
 

Author Comment

by:agwalsh
ID: 39675264
hm, I've shown them how to do the form thingy but one of the people I was working with had seen it in a query (date dropdown) and wanted to know how to do it...but will try out your suggestions...thank you :-)
0
 
LVL 85
ID: 39675539
FWIW - Users really should not be interacting directly with queries (or tables), simply because there is a great risk of data destruction or modification.
0
 
LVL 38

Accepted Solution

by:
PatHartman earned 250 total points
ID: 39675548
If you use a form, you can use a combo or a text box and if you are not entering a real date, you should validate the data before using it.  Access will validate dates as long as you define the control with a date format.  If you want just a month (I'm not sure why you don't also want year), you should have a validation rule that limits the value to 1-12.

It is also poor practice to open queries for users to interact with so a form or report would be better.  Then you can pass in the "date" with the OpenForm/OpenReport by using the Where argument
0
 

Author Closing Comment

by:agwalsh
ID: 39726967
Had to go a different route but this was helpful :-)
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

696 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