Cannot get query to work with my date select form

fvreg

Registered User.
Local time
Today, 00:57
Joined
Sep 15, 2005
Messages
15
With the imense help of some of the people in this forum, I have scraped together a nice little database.
There is one function, however, which is not working.

I have a query that should run from a form I have created. The form has multiple criteria and all seem to be working except for the date fields... "First Order" and "Last Order".
The way I have it set up is that I have a table of dates. The form has a list box of the dates (first of the month, for 4 years).
The source data in the form reads: SELECT [TDateSelect].[StartDates] FROM TDateSelect ORDER BY [TDateSelect].[StartDates]; (for each of the 2 "minimum" dates)
and SELECT [TDateSelect].[EndDates] FROM TDateSelect ORDER BY [TDateSelect].[EndDates]; (for each of the 2 "max" dates)
The user is allowed to select a date range for the first order and the last order. (4 dates altogether).

The form looks fine.

In the query, I have set the criteria for the last date as:
Between [Forms]![FSetOtherCriteria].[MinLast] And [Forms]![FSetOtherCriteria].[MaxLast]

When I run the query (even with a wide date range) I get no results. When I remove the dates from the query, or enter the limits manually, the query works like a dream.

Any ideas???
 
you problem lies with using list box's well that my thought anyway.

If you used general text boxes then this would work ok.

I'm a bit confussed by when you say the users selects 4 dates.

You do some code to automatically put the correct date into each hidden text box, and make sure they are in the correct order if they need to be, i.e the first date is always lower then the second, or something like that...

I generally cheat a little when using listboxes for the user to select information that is going to affect a query. What i do is when the user clicks into the list box i then have a hidden field which enters the information in from the list box, this way the queries seem easier to build, and always work.

I'm not saying this is the best method, but one i use, if anyway knows of another way then i would be very interested in hearing it... I'm always willing to alter my present methods to better ones....

I hope this helps, please let me know if you need any more help, or if you are completely confussed by what i have said.
 
To hopefully answer your questions more fully:

I have a table with 2 columns, min date and max date. The min column has month beginnings (1/1/05, etc.) and the max has month end (1/31/05, etc).

My form then has a list box for Last Class Taken Min and Last Class Taken Max, which lists the values in the table.
The query then has the following criteria for Last Class Taken:
Between [Forms]![FSetOtherCriteria].[MinLast] And [Forms]![FSetOtherCriteria].[MaxLast]

I have the same set-up for First Class taken.

In case the user does not want to narrow these fields in the query, I have the min value set for 1/1/01 and max values set for 12/31/06 to capture all values.
 
I have attached a screenprint for you to get an idea of how I think the form should ultimately look.
 

Attachments

  • Screenprint.jpg
    Screenprint.jpg
    69.3 KB · Views: 219

Users who are viewing this thread

Back
Top Bottom