Solved

Creating a parameter query in Access that prompts for dates?

Posted on 2013-11-25
5
224 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 84

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 84
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 36

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
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 …

733 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