ChampionDuy
Registered User.
- Local time
- Today, 03:35
- Joined
- Mar 14, 2002
- Messages
- 94
I have a form that is based on one table that selects diferent fields from a table. The form is opened by the user after the user types in quarter dates, a quarters beginning date and ending date. The form should only display records if that record has a date in that range. I have tried to solve this two ways and I cant get it to work right. The first way I tried it was I just created a form that held the fields that I needed and then on the Open event of that form I compared the text boxes that contain the certain dates to a global variable that I declared as the dates the user enters. This worked but it only compares the first record in the table. It does not search and compare the whole table. The Second way I tried it was with a Query that passed global variables into it. This worked when I ran the query but for some reason it does not when I save it as a form. For some reason it gives me like 300 records when there should be only 15. For some reason I dont think it is looking at the dates. Here is the query.
SELECT [Type], [crime], [command], [CCN], [Locate], [Perunit], [Approve], [Auth], [Expdate], [Status], [results], [Eval1], [Eval2], [Eval3], [Eval4]
FROM casefile
WHERE (ExpDate>=StartDateFun() And ExpDate>=EndDateFun()) Or (Auth>=StartDateFun() And Auth<=EndDateFun());
The startdatefun and enddatefun are functions that I use to try to pass the global variable to the query for date comparison. Any help would be greatly appreciated. Thanks
SELECT [Type], [crime], [command], [CCN], [Locate], [Perunit], [Approve], [Auth], [Expdate], [Status], [results], [Eval1], [Eval2], [Eval3], [Eval4]
FROM casefile
WHERE (ExpDate>=StartDateFun() And ExpDate>=EndDateFun()) Or (Auth>=StartDateFun() And Auth<=EndDateFun());
The startdatefun and enddatefun are functions that I use to try to pass the global variable to the query for date comparison. Any help would be greatly appreciated. Thanks