Filtering Data

G

Guest

How do I filter for a date range. If I have a column that has dates
formatted like 4/1/04, 4/22/04, 5/22/05 etc. in each row, how do I filter
just for date within the range of 4/1/04-4/30/04?
 
G

Guest

Assuming this is in a table, create a query built on your table, drag the
fields you want into the grid.

In the criteria row of the date field type the following:
Between #4/1/04# and #4/30/04#
 
G

Guest

Ok, that answered my question, but I didn't form the question properly. So
let me try again.

I have a table, a rather LARGE table, that currently has a specific date
column, and month column so that people can filter for just "january", or
"february", etc. The reason this database has become so large is that people
have created columns because either they thought they needed that information
to extract data or just weren't thinking about the information necessary.

My question, Do I need to create a query to extract a range of dates and
subsequent records that match that date range?

I hope I'm clearer this time as to what I need. Thanks for your initial
reply. That did help me.
 
G

Guest

If I am reading you correctly, You are trying to filter your master table to
a date range, say Jan 04 to Dec 04, and then filter again for a specific
month?

If so, build the query as before, on the same criteria row as your date
range, enter the month in the criteria of the month column. You are
building an "and' statement. In Sql it would look something klike;

Where (DateRange Between #1/1/2004# and #12/31/2004#) AND Month IN( "Jan",
"Feb")

Hope this helps
Rosco
 
G

Guest

I don't want to filter on two columns. I would like to rid of the month
column altogether and just filter (if that's even the best way) the date
column for a range like 1/1-1/31, or 4/1-4/31.

Do I have to do it through a query? If so, to build this query I close the
table, create a new query based on that table and then in the criteria what
do I put if the range will always change?
 
G

Guest

OK , here is what I would do. Build your query but for the time being don't
put any criteria in. Next, make a form. On the form add 2 text boxes (you
could name them txtStartDate and txtEndDate). Format the the text boxes for
short date. Also Add a command button. Save and name the form.

Back in the query, type in your date criteria:
Between [Forms]![myform]![txtStartDate] And [Forms]![myform]![txtEndDate].
Where myForm is the actual form name.

Save and close the query.

Back in your form right click on the command button and click on proporties.
In the On Click event in the event tab click the build icon (the...) to the
right

In the sub routine that opens type
DoCmd.OpenQuery "thequeryName",acNormal,acEdit
where "The QueryName is the real name of your query. Include the double
quotes.

In the debug menu, click on Compile, then save. and close the VBA editor.

When you open the form , type in your dates, then click the command button,
and your query should run. There's lots you can do to make the form look good
and professional, and different output options, but this is the basics.

Hope this helps.
Leaving for home now, If you have any more questions I'll check in AM, or
I'm sure others here will be glad to pictch in.

Rosco
 

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

Similar Threads

Merging Qry into Table 2
Date Format 1
convert GMT Date & Time 6
filtering outlook messages 4
Largest Date 10
Calculating number of days between multiple dat2 1
Add to a "number as text" 10
Sumproduct with variation 1

Top