Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Current DATE in a filter string 2

Status
Not open for further replies.

guava65

Programmer
Jul 20, 2001
238
US
I would like to input a fileter string programmatically instead of forcing the user to enter the string each time. The only change to the string would be the current date:

How can I combine a string of text and at the end of the text include the current date. I would like to end up with something like:

InDate < '01/01/2003'

The date would have to change to the current system date.

Thanks in advance.



Aloha,
cg
 
Im assuming that you mean a table filter? Just create a string wherever you need to like this.

MyFilter : String;

MyFilter := 'INDATE < ' + quotedStr(DateToStr(Date));

Then set the filter to the string. Or you could just set the filter directly, either way, just as good.

Table1.Filter := 'INDATE < ' + quotedStr(DateToStr(Date));

HTH

Arte Et Labore
 
try something like
Code:
  ...
  Table1.Active := false;
  Table1.Filter := 'Week > ' + QuotedStr(FormatDateTime ( 'dd/mm/yyyy', Now ) );
  Table1.Filtered := true;
  Table1.Active := true;
  ...

This works in Delphi 5.

Andrew
 
The second line in my example should have your variable field 'INDATE' instead of my variable 'week'.

Sorry about that.

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top