A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Query by month



 
 
Thread Tools Display Modes
  #1  
Old October 15th, 2009, 04:20 PM posted to microsoft.public.access.forms
Humbled Learner
external usenet poster
 
Posts: 36
Default Query by month

I have a query which returns all information from two tables.

I would to build a search form which askes for beginning and closing date.
After adding the dates, I would like a query (or report) to open in a subform
and reflect the rows from the query only between those dates.

I know how to build the form and subform, just not complete the search and
results.

Where do I start?

Thank You.


  #2  
Old October 16th, 2009, 02:53 AM posted to microsoft.public.access.forms
Allen Browne
external usenet poster
 
Posts: 11,706
Default Query by month

In the Criteria row of the query, under your data field, enter something
like this (as one line):
= [Forms].[Form1].[txtStartDate] And [Forms].[Form1].[txtEndDate] + 1


Substitute your search form's name for Form1, and your textbox names for
txtStartDate and txtEndDate.

If these controls are unbound, declare the parameters in the query to ensure
Access understands the data type. In query design view, choose Parameters
from the menu/ribbon. Access opens a dialog, where you enter 2 rows like
this:
[Forms].[Form1].[txtStartDate] Date/Time
[Forms].[Form1].[txtEndDate] Date/Time

For more details, and another possible approach, see:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Humbled Learner" wrote in
message ...
I have a query which returns all information from two tables.

I would to build a search form which askes for beginning and closing
date.
After adding the dates, I would like a query (or report) to open in a
subform
and reflect the rows from the query only between those dates.

I know how to build the form and subform, just not complete the search and
results.

Where do I start?

Thank You.


  #3  
Old October 18th, 2009, 05:03 PM posted to microsoft.public.access.forms
Me!Frustrated = True
external usenet poster
 
Posts: 7
Default Query by month

If you already have controls on your form for the two dates, enter this in
the 'Criteria' for the date field in your query:

Between [Forms]![myForm]![startdate] And [Forms]![myForm]![closingdate]

replace 'myForm' with the name of your form for entering dates, replace
'startdate' and 'closing date' with the names of the controls on the form.

To display the results in the subform, set its Record Source to that query.

hth

"Humbled Learner" wrote:

I have a query which returns all information from two tables.

I would to build a search form which askes for beginning and closing date.
After adding the dates, I would like a query (or report) to open in a subform
and reflect the rows from the query only between those dates.

I know how to build the form and subform, just not complete the search and
results.

Where do I start?

Thank You.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.