Use the date and > < as criteria ???

Doppenberg

Registered User.
Local time
Today, 16:09
Joined
May 25, 2000
Messages
25
I have a problem with a date on my report. I want the user to type a date and select before or after. When they push the report button the report has to show the fields before or after the selected date.
I created some code in the On_Click event of the button that puts the right string in a textbox, like this :
[dateString] = "<#" & [TypedDate] & "#"

In the recordsource of my report i have set the criteria of the date to the textbox [datestring].
But this does not work, i get an error message saying that the criteria is incorrect or too complex.
When I type this string as criteria in the report myself, it works great.

Can anyone tell me what i do wrong or is there an alternative way to do this?
Any help would be greatly appreciated.
Thanks, Tim.
 
What your doing wrong is the criteria is now ="<#[Yourdate]#"

what you want to do is -

<[txtYourText] as the criteria

then put your date in the txtbox and i should work.

Mitch.
 
Thanks, this helped a bit, but not completely.
The user must make a choice in the form whether the criteria is after (> ) or before (< ) the given date. Now it is always <.
How do I put the right choice in the criteria ?
Can I make an If statement in the criteria to check for that?
ex. IF choice = before then criteria = < [date]
Else criteria = > date.

Is this possible ?

Tim
 
OK, let's keep it simple and just avoid the problem. Copy your query and paste it calling it the same name appended with 'Greater' or something then on the run report button if they have selected Less than run the report with less than query as the data source else run it with the greater query. If thats a bit basic or you have lots of other options, then say and we can dynamically create and sql string to run your report from. Hope this helps.

Mitch.
 
This is indeed a bit to simple for my problem. I will give you some background info. The report is for a "Reminder System" (I don't know the exact name for it in English, I'm not English).
In the db the user is able to enter a "Reminder". There are four field that can be entered, a date that the reminder was created (beginningdate, the systemdate), the date to be reminded (enddate), a status from a combobox (call customer, send mailing, etc) and the user that this reminder applies to from a combobox.

To see a report the user can select for example the reminder that will expire within two weeks, only with his name on it and only with the status "call customer". He should be able to decide whether or not to fill a filed, when the fields are empty, no criteria should be selected, thus displaying all records.

I hope this makes things a bit clearer and i hope that you can help me, because I can't get it to work.
I would appreciate your help very much !

Tim.
 

Users who are viewing this thread

Back
Top Bottom