Solved

Date

Posted on 2001-07-02
9
338 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now