Parameters to search between years

S

sebastico

Hi Everyone,

Access 2003. I have a query that I have set up so the user can type in
in a txtbox (in a form) the year (string) and the query workks great. This
is my parameter:
Like [Forms]![Search].[txtYyear] & "*"

1. I would like to include a criteria to search between two years in the
same txtbx. Could you suggest me how to do it?

2.In the same query I have another parameter:
Like [Forms]![Search].[txtTwn] & "*"
This allow me to write only one word in a txtbx same form), but I would like
to write two or three words.Could you help me?

Your help is greatly appreciated


.. They pull data for the month so the first date they enter
is 3/1/10 and the end date is 3/31/10. I want all records between these
dates but anything that is 3/31 doesn't show up inless I type in 4/1. Is
there a way I can add something in the expression so it automatically adds
the one day?
 
J

John W. Vinson

Hi Everyone,

Access 2003. I have a query that I have set up so the user can type in
in a txtbox (in a form) the year (string) and the query workks great. This
is my parameter:
Like [Forms]![Search].[txtYyear] & "*"

1. I would like to include a criteria to search between two years in the
same txtbx. Could you suggest me how to do it?

2.In the same query I have another parameter:
Like [Forms]![Search].[txtTwn] & "*"
This allow me to write only one word in a txtbx same form), but I would like
to write two or three words.Could you help me?

Your help is greatly appreciated


. They pull data for the month so the first date they enter
is 3/1/10 and the end date is 3/31/10. I want all records between these
dates but anything that is 3/31 doesn't show up inless I type in 4/1. Is
there a way I can add something in the expression so it automatically adds
the one day?

Date/Time fields are not stored as strings. Instead, they're stored as numbers
- a count of days and fractions of a day (times) since midnight, December 30,
1899. If you use a LIKE operator Access will convert the number to a formatted
date string and search that, but you might not get the results you expect!

Try using a Form with two unbound textboxes txtStartDate and txtEndDate. To
pick up date/time values *on* txtEndDate (i.e. later than midnight on that
date but before midnight the next night), you can use a query criterion
= NZ([Forms]![Search]![txtStart], #1/1/100#) AND < DateAdd("d", 1, NZ([Forms]![Search]![txtEnd], #12/30/9999#))

If the txtStart box is left blank it will find all records up to the end of
the day on txtEnd; if txtEnd is left blank, it will find all records on or
later than txtStart.
 
S

sebastico

I tested this parameter and works as well.
Many thanks. I learned more with your help
 

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