want to query to ask date from and date to

mqq

New member
Local time
Today, 00:03
Joined
Mar 7, 2007
Messages
4
I have a database that has a query created, I want to refine the query to ask first for datefrom and dateto then display the relevant info between those dates.
 
look at "between #date1# and #date2#"
 
is is quite easy
if you qry is on a button on a form
put on the form 2 date fields from and to

then in your qry and date field put between forms!(formname)!from and forms!(formname)!to
this will read fromth e dates in the form
if left blank it asks
 
thanks

Thanks for the info. Can you give more detail though, please.
 
Right you have a date field soemwhere on your qry Yes

this is called datefield (or whatever you have called it ) now you want to filter this data between 2 given ranges -- yes


you could type in
between 01/01/06 and 31/01/06 first of jan till the 31 jan

if you using us format change it around this will get all the dates between these ranges

now to make this a bit smarter and user friendly

make a new form call xxxxxx - whayever name makes sense


on this form use the button wizard to run qry (ignore the bit I have just given you)
it will run the qry and give all the results

right --good

now on your form put 2 date fields in
call one xxfrom and the other one xxto

now in your qry under the date range
enter between Forms !xxxxxx!from and forms!xxxxx!to

now change the format of the date entery on the form "from" and "to" to the same format this will allow you to change the date quicker and is user friendly
 
Between [Forms]![OrgBdxBrokSum]![FromDate] And [Forms]![OrgBdxBrokSum]![ToDate]

heres the excat code from a d/base I no longer use

OrgBdxBrokSum is the name of a form
Fromdate is the name on the control on the form
the date format of this field is dd/mm/yyyy
Todate is the control name of the other date field again format dd/mm/yyyy
the Forms! is telling the qry go the forms and then the OrgBdxBroSum! is say go here then you have the fieldnames .


G
 
Hi

I tried to put code into the criteria section of the qurery and kept getting errors. Also I am not sure how to change the form. Does thec form not only show records?? I am new to access and very confused
 

Users who are viewing this thread

Back
Top Bottom