PaidtheUmpire
Programmer
Hey peoples,
What I'm trying to do is have 6 checkboxes at the top of the screen, each of which refers to an option for field in a database.
When one or more is checked/unchecked, the StringGrid will only show the rows where the options is checked.
If you have only "Renting" and "Booking" selected then only the rows with either "Renting" or "Booking" in the Status field are shown.
Any ideas? This is the code that I currently have and it is not working, i can't tell why but i guess it has something to do with either the update StringGrid or the Where in the SQL.
Thanking you in advance,
Rick
What I'm trying to do is have 6 checkboxes at the top of the screen, each of which refers to an option for field in a database.
When one or more is checked/unchecked, the StringGrid will only show the rows where the options is checked.
If you have only "Renting" and "Booking" selected then only the rows with either "Renting" or "Booking" in the Status field are shown.
Any ideas? This is the code that I currently have and it is not working, i can't tell why but i guess it has something to do with either the update StringGrid or the Where in the SQL.
Thanking you in advance,
Rick
Code:
procedure TForm1.ScheduleCheckBox(Sender: TObject);
var WhereThing : string;
begin
If BoxRenting.Checked = True then
WhereThing := '(((Booking.Status)="Renting" ';
ScheduleADO.Close;
ScheduleADO.SQL.Text := 'SELECT Booking.RentalNumber, Booking.PhoneCode, Booking.ClientName, Booking.Status, Booking.DatePickup, Booking.DateReturn ' + #13#10
+ 'FROM Booking ' + #13#10
+ 'WHERE ' + WhereThing + #13#10
+ 'ORDER BY Booking.RentalNumber;';
ScheduleADO.Open;
ScheduleGrid.Repaint;
end;