Query by request

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all,

I am new with Query in Access.

I have 2 fileds in the Query: Username, Mins, Date

I have already created a Query which Groupby and Sum of Mins.

Now what can I do to create a Request Form on Date for my Query. So my Query
can show only all information about the Username, Min on the requested Date?

Can you show me a Hint?

Thanks alot Guys!
 
The cheap and cheerful way is to use a simple parameter in the query; in
query design view enter something like the following in the 'criteria' row of
the date column:

[Enter date:]

Then, still in design view, select Parameters form the Query menu and enter
[Enter date:] in the left column of the first row in the dialogue, and select
Date/Time in the second column of the same row. Its always a good idea to
declare parameters in this way, and even more so with date values as a date
in short date format can otherwise be interpreted as an arithmetical
expression and give the wrong result.

A more developed solution is to create an unbound form and add a text box in
which the date is entered. Add a button to the form to open the query, or
better to open a form or report based on the query. In the query, in place
of the simple parameter as above, put a reference to the control on the form.
e.g.

Forms!frmMyDialogue!txtDate

Declare the reference to the control as a parameter of date/time data type
in the same way as above. Using an unbound dialogue form in this way has the
advantage of enabling you to do things such as validating the date entered,
or you can use a control such as combo box or text box which lists all the
available dates so the user only has to select one from the list. The
RowSource of a list or combo box to do this would be something like:

SELECT DISTINCT [Date]
FROM YourTable
ORDER BY [Date];

I would suggest, however, that you avoid using Date as a column (field)
name. It could be confused by Access with the built in Date function. Its
better to use an explicit terms such as TransactionDate or whatever suits the
context.

Ken Sheridan
Stafford, England
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top