query prompt for One or ALL months in database

K

KAnderso

I have a database with "Contact Dates". I want to write a criteria in my
query to prompt me to select a particular month/year or ALL of the
dates/months. How would I do this?
 
K

KAnderso

The Null piece works great; however, the first part, not so well. In my
table, I have Contact Dates (mm/dd/yyyy), I would like to run a query with a
prompt that would pull say Oct-2009 or ALL. Does this make sense?

Thanks for the help.
Kim

KARL DEWEY said:
[Enter month-year (11/1/2008)] OR [Enter month-year (11/1/2008)] Is Null
--
Build a little, test a little.


KAnderso said:
I have a database with "Contact Dates". I want to write a criteria in my
query to prompt me to select a particular month/year or ALL of the
dates/months. How would I do this?
 
K

KARL DEWEY

Does your table have a Text or DateTime field?
If it is DateTime then try this --
WHERE Format([Contact Dates], "yyyymm") = [Enter year-month (200811)] OR
[Enter year-month (200811)] Is Null

Text field --
WHERE Right([Contact Dates], 4) & Right("0" & Val(Left[Contact Dates], 2)),
2) = [Enter year-month (200811)] OR [Enter year-month (200811)] Is Null


--
Build a little, test a little.


KAnderso said:
The Null piece works great; however, the first part, not so well. In my
table, I have Contact Dates (mm/dd/yyyy), I would like to run a query with a
prompt that would pull say Oct-2009 or ALL. Does this make sense?

Thanks for the help.
Kim

KARL DEWEY said:
[Enter month-year (11/1/2008)] OR [Enter month-year (11/1/2008)] Is Null
--
Build a little, test a little.


KAnderso said:
I have a database with "Contact Dates". I want to write a criteria in my
query to prompt me to select a particular month/year or ALL of the
dates/months. How would I do this?
 
K

KAnderso

Karl,
Thank you...that did it (the first one - for DateTime Field)!

Kim

KARL DEWEY said:
Does your table have a Text or DateTime field?
If it is DateTime then try this --
WHERE Format([Contact Dates], "yyyymm") = [Enter year-month (200811)] OR
[Enter year-month (200811)] Is Null

Text field --
WHERE Right([Contact Dates], 4) & Right("0" & Val(Left[Contact Dates], 2)),
2) = [Enter year-month (200811)] OR [Enter year-month (200811)] Is Null


--
Build a little, test a little.


KAnderso said:
The Null piece works great; however, the first part, not so well. In my
table, I have Contact Dates (mm/dd/yyyy), I would like to run a query with a
prompt that would pull say Oct-2009 or ALL. Does this make sense?

Thanks for the help.
Kim

KARL DEWEY said:
[Enter month-year (11/1/2008)] OR [Enter month-year (11/1/2008)] Is Null
--
Build a little, test a little.


:

I have a database with "Contact Dates". I want to write a criteria in my
query to prompt me to select a particular month/year or ALL of the
dates/months. How would I do this?
 

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

Top