Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4618756
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:18:43+00:00 2026-05-22T02:18:43+00:00

Dear experts, I’m trying to filter the result in dbgrid connected to adoquery, depending

  • 0

Dear experts,
I’m trying to filter the result in dbgrid connected to adoquery, depending on user selection of 4 checkboxes, user can select one or more fileds to filter the data accordingly
I have this code, and I don’t know how to pass “and/ or not pass” it if user select two or more checkboxes.

Vw_Activity.SQL.Text:='select * from Vw_Activity where ';
if CBEmployee.Checked then
begin
Vw_Activity.SQL.Add('Emp_Name_Ar=:x');
Vw_Activity.Parameters.ParamByName('x').Value:=emp Name.Text;
end;


if CBTask.Checked then
begin
Vw_Activity.SQL.Add('Category_Name=:y');
Vw_Activity.Parameters.ParamByName('y').Value:=Pro blemCat.Text;
end;

if CBIncharge.Checked then
begin
Vw_Activity.SQL.Add('Support_name_En=:h');
Vw_Activity.Parameters.ParamByName('h').Value:=Sup portstaff.Text;
end;


if CBstatus.Checked then
begin
Vw_Activity.SQL.Add('Request_Status=:k');
Vw_Activity.Parameters.ParamByName('k').Value:=Req uestStatus.Text;
end;

Vw_Activity.Active:=true;

waitting your help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:18:44+00:00Added an answer on May 22, 2026 at 2:18 am

    you can rewrite your sql sentence to (check the final 1=1)

    select * from Vw_Activity where 1=1
    

    and then add each condition like this

    Vw_Activity.SQL.Text:='select * from Vw_Activity where 1=1 ';
    if CBEmployee.Checked then
    begin
      Vw_Activity.SQL.Add('AND Emp_Name_Ar=:x');
      Vw_Activity.Parameters.ParamByName('x').Value:=emp Name.Text;
    end;
    
    
    if CBTask.Checked then
    begin
      Vw_Activity.SQL.Add('AND Category_Name=:y');
      Vw_Activity.Parameters.ParamByName('y').Value:=Pro blemCat.Text;
    end;
    
    if CBIncharge.Checked then
    begin
      Vw_Activity.SQL.Add('AND Support_name_En=:h');
      Vw_Activity.Parameters.ParamByName('h').Value:=Sup portstaff.Text;
    end;
    
    
    if CBstatus.Checked then
    begin
      Vw_Activity.SQL.Add('AND Request_Status=:k');
      Vw_Activity.Parameters.ParamByName('k').Value:=Req uestStatus.Text;
    end;
    
    Vw_Activity.Active:=true;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Dear experts, I was trying to align an paragraph to the middle of an
Dear experts, I was trying to dynamically generate DOM elements using JS. I read
Dear LINQ or linq2sql experts, can you help me to solve this case? I
Dear Experts; I have two questions about of MySQL. Q1 : Can I access
Dear experts, I am quite new to javascript and I often see coders use
Dear Stacktoverflow, can you show me an example of how to use a QScrollBar?
Dear all, I have a question about Facebook Page: ( NOT user profile page,
Dear all, I have a select query that currently produces the following results: DoctorName
Dear All, I am trying to parse the following HTML fragment, and I would
Dear SQL Gurus from Stack Overflow: Environment: Oracle I'm trying to understand why I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.