2

i have the following query

SELECT *
FROM Project
WHERE Status = "In Progress"

when i run the program it successfully lists all the project titles with the status 'In Progress' in a DBlookuplistbox, I have a button with the code:

adoqCurrentProjects.Active := false;
adoqCurrentProjects.Active := true;

adoqCurrentProjects is the name of the adoquery, however when i click the button the error message 'Data type mismatch in criteria expression' appears. I would have thought that if i changed the amount of records in the Project table with the status "In Progress" and clicked the button it would just list the new results in the DBlookuplistbox as it does when i restart the program, any suggestions?

LU RD
  • 34,438
  • 5
  • 88
  • 296
Jeowkes
  • 501
  • 7
  • 20
  • The error message indicates that Status and the search value are different types. Since your message indicates both are strings, then maybe the query is being modified at runtime somewhere.. do you have any events tied to the adoqCurrentProjects component? Seems like maybe the quotes are getting removed somewhere.. just a guess.. – John Easley Apr 10 '12 at 22:24

1 Answers1

1

Alternative procedure to update ADOQuery could be

with adoqCurrentProjects do begin
 close;
 sql.Clear;
 sql.Add('SELECT * FROM Project WHERE Status = '+condition);
 open;
end;

// Update DBlookuplistbox
J A
  • 1,776
  • 1
  • 12
  • 13