Solved

Date

Posted on 2001-07-02
9
343 Views
Last Modified: 2011-09-20
I want to filter my tables DATE field to Date+7 but i want to filter not only date+7 i also want date+6 date+5 date+4 date+3 date+2 and date+1. My table connected to a datasource and a DBGrid to a datasource. I want to show all filtered records on DBGrid. If i try:

Table1.Filter := 'DATE = ''' + datetostr(date+7) + '''';
it only Filter records that has (if today is 01.01.1999) 07.01.1999 on DATE field. But as i said before i want to filter dates between today and seven days later..
0
Comment
Question by:systemop
  • 4
  • 3
  • 2
9 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 6243999
Try this:

Table1.Filter := 'DATE between''' + datetostr(date) + ' and ' + datetostr(date+7) + '''';
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 6244024
Maybe it's necessary to use date+8 instead of date+7:

Table1.Filter := 'DATE between''' + datetostr(date) + ' and ' + datetostr(date+8) + '''';
0
 

Author Comment

by:systemop
ID: 6244074
Epsylon it gives this error :

Filter expression incorrectly terminated..
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 13

Expert Comment

by:Epsylon
ID: 6244143
Table1.Filter := 'DATE between''' + datetostr(date) + ''' and ''' + datetostr(date+8) + '''';
0
 
LVL 9

Accepted Solution

by:
ITugay earned 50 total points
ID: 6244148
Hi systemop,

  Query1.Filter :=  'PJ_BEG >= '''+DateToStr(Date)+''' AND PJ_BEG < '''+DateToStr(Date+7)+'''';
  Query1.Filtered := true;

----
Igor.
0
 

Author Comment

by:systemop
ID: 6244210
Epsylon it gives same error.

ITugay i use Table1 not Query how can i solve this with Table
0
 
LVL 9

Expert Comment

by:ITugay
ID: 6244225
The same way, Just change Query1 to Table1 :-)
------
Igor.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 6244235
Another shot  :o)

Table1.Filter := 'DATE between ''' + datetostr(date) + ''' and ''' + datetostr(date+8) + '''';
0
 

Author Comment

by:systemop
ID: 6244259
Thank you ITugay it works..
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question