Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 03-31-2006, 01:26 PM
SourceCode SourceCode is offline
Senior Member
 
Join Date: Apr 2005
Posts: 810
Default get recently modified (DBGrid)

Using ADOQuery and Access.

I want to show rows in grid that have been recently added in a different colour.
I know how to color the rows - but how can I tell if the item has been recently added or the row has been edited since aplication has been running?

Thanks for your help!
Reply With Quote
  #2  
Old 03-31-2006, 01:51 PM
AceOmega AceOmega is offline
Senior Member
 
Join Date: Sep 2004
Posts: 2,393
Default RE: get recently modified (DBGrid)

Do you have a ModifiedDate field in your table? If so then use the On Draw event of your DbGrid like so...

[DELPHI]procedure TForm2.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
If Query1.FieldByName('Modified').Value = Date then
DBGrid.Canvas.Color := clRed;
end;[/DELPHI]

If you don't have a modified field then add one and add a trigger to update the field on modify. I don't know if Acces has triggers or not because I have not messed with Access since 2000. It did not have that kind of support but they may have changed it. If they don't then you can put it in your before posts in Delphi.
Reply With Quote
  #3  
Old 03-31-2006, 01:55 PM
AceOmega AceOmega is offline
Senior Member
 
Join Date: Sep 2004
Posts: 2,393
Default RE: get recently modified (DBGrid)

Yep they do have triggers. Go here to find out how to setup a trigger in Access....

http://office.microsoft.com/en-us/assistance/HA010345351033.aspx?mode=print
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:18 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.