?
Solved

Creating a parameter query in Access that prompts for dates?

Posted on 2013-11-25
5
Medium Priority
?
235 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 750 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 750 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
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…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

777 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