Search dates 'From' 'to' in form

  • Thread starter Thread starter jackie
  • Start date Start date
J

jackie

I know that several people have answered this questions, and I have tried
different techniques as a solution, but all have failed.
I have 2 unbound boxes on my form txtStartDate and txtEndDate. I have gone
into the query and entered:

between Forms![Myform]![TextStartDate] and [Form]![Mform]![TxtEndDate]

Someone suggested that I also enter the two lines in Tools>Quey>Parameter. I
tried adding a parameter and leaving it out using only the criteria above.
However, when I go to the form, it does not filter by date.

BTW, My form has two other boxes for "location" and "street adress". These
boxes work fine. They run macros, which run queries.
Would sorting a field in the query have any effect on the results. Thanks
for any help.
 
I have tried different techniques as a solution, but all have failed.
What did it not do? What did it do it was not supposed to do?
between Forms![Myform]![TextStartDate] and [Form]![Mform]![TxtEndDate]

Myform is not the same as Mform.

--
KARL DEWEY
Build a little - Test a little


jackie said:
I know that several people have answered this questions, and I have tried
different techniques as a solution, but all have failed.
I have 2 unbound boxes on my form txtStartDate and txtEndDate. I have gone
into the query and entered:

between Forms![Myform]![TextStartDate] and [Form]![Mform]![TxtEndDate]

Someone suggested that I also enter the two lines in Tools>Quey>Parameter. I
tried adding a parameter and leaving it out using only the criteria above.
However, when I go to the form, it does not filter by date.

BTW, My form has two other boxes for "location" and "street adress". These
boxes work fine. They run macros, which run queries.
Would sorting a field in the query have any effect on the results. Thanks
for any help.
 
I know that several people have answered this questions, and I have tried
different techniques as a solution, but all have failed.
I have 2 unbound boxes on my form txtStartDate and txtEndDate. I have gone
into the query and entered:

between Forms![Myform]![TextStartDate] and [Form]![Mform]![TxtEndDate]

Someone suggested that I also enter the two lines in Tools>Quey>Parameter. I
tried adding a parameter and leaving it out using only the criteria above.
However, when I go to the form, it does not filter by date.

BTW, My form has two other boxes for "location" and "street adress". These
boxes work fine. They run macros, which run queries.
Would sorting a field in the query have any effect on the results. Thanks
for any help.

Sorting the results doesn't matter. Somehow your query isn't getting
the correct criteria, or you are misinterpreting your results.

Sometimes it is helpful to divide the problem into sections so that
you can figure out what's happening.

Try changing your query temporarily to "hardcode" the dates. For
example, enter Between #1/1/2007# And #3/1/2007# for the criteria. Can
you make it work that way?

Are you getting a pop-up asking for parameter values? If you are,
that would indicate that you have a typo somewhere and that your query
can't find the controls on your form.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 
No, it just gives me all records. For example if I enter the location "PA",
it gives me all records for PA, not PA records from 1/1/2008 to 1/20/2008. (I
am looking data for a particular month.)


Armen Stein said:
I know that several people have answered this questions, and I have tried
different techniques as a solution, but all have failed.
I have 2 unbound boxes on my form txtStartDate and txtEndDate. I have gone
into the query and entered:

between Forms![Myform]![TextStartDate] and [Form]![Mform]![TxtEndDate]

Someone suggested that I also enter the two lines in Tools>Quey>Parameter. I
tried adding a parameter and leaving it out using only the criteria above.
However, when I go to the form, it does not filter by date.

BTW, My form has two other boxes for "location" and "street adress". These
boxes work fine. They run macros, which run queries.
Would sorting a field in the query have any effect on the results. Thanks
for any help.

Sorting the results doesn't matter. Somehow your query isn't getting
the correct criteria, or you are misinterpreting your results.

Sometimes it is helpful to divide the problem into sections so that
you can figure out what's happening.

Try changing your query temporarily to "hardcode" the dates. For
example, enter Between #1/1/2007# And #3/1/2007# for the criteria. Can
you make it work that way?

Are you getting a pop-up asking for parameter values? If you are,
that would indicate that you have a typo somewhere and that your query
can't find the controls on your form.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 
No, it just gives me all records. For example if I enter the location "PA",
it gives me all records for PA, not PA records from 1/1/2008 to 1/20/2008. (I
am looking data for a particular month.)

Are you sure that the dates are using an AND, not an OR? It should be
AND. In the query designer, they need to be on the same line as the
Location criteria. Or you can look at the SQL view to see if whether
it's using AND or OR.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 
Back
Top