BillKilgore
Programmer
Hello,
I've been trying to get a SELECT statement addressing an MS Access 2000 database.
This is the code as it is currently failing;
begin
close;
SQL.clear;
SQL.Add('SELECT * FROM Logs
WHERE Specie = '+ebSpecie.Text'
AND ProcessDate = '+ebDate.Text);
Active := True;
open;
LogRecd.log_number := FieldByName('LogNumber').Value;
LogRecd.specie := FieldByName('Specie').AsString;
.
.
.
I've tried several variants such as;
SQL.Add('SELECT * FROM Logs
WHERE Specie = '+QuotedStr(ebSpecie.Text)'
AND ProcessDate = '+QuotedStr(ebDate.Text));
which didn't work and one that did shown below;
SQL.Add('SELECT * FROM Logs
WHERE Specie = ''Pine''
AND ProcessDate = ''3/7/07');
(The examples shown are stacked to conform to this format. The actual code is all in one line)
Switching out the constants 'Pine' and '3/7/07' results in error message 190, 'Missing operator or semicolon.'
At first I though the problem was a matter of quotes but now I think the problem is deeper. Having to do with the presence of variables.
Any help would be greatly appreciated. Thank you.
Bill Kilgore
I've been trying to get a SELECT statement addressing an MS Access 2000 database.
This is the code as it is currently failing;
begin
close;
SQL.clear;
SQL.Add('SELECT * FROM Logs
WHERE Specie = '+ebSpecie.Text'
AND ProcessDate = '+ebDate.Text);
Active := True;
open;
LogRecd.log_number := FieldByName('LogNumber').Value;
LogRecd.specie := FieldByName('Specie').AsString;
.
.
.
I've tried several variants such as;
SQL.Add('SELECT * FROM Logs
WHERE Specie = '+QuotedStr(ebSpecie.Text)'
AND ProcessDate = '+QuotedStr(ebDate.Text));
which didn't work and one that did shown below;
SQL.Add('SELECT * FROM Logs
WHERE Specie = ''Pine''
AND ProcessDate = ''3/7/07');
(The examples shown are stacked to conform to this format. The actual code is all in one line)
Switching out the constants 'Pine' and '3/7/07' results in error message 190, 'Missing operator or semicolon.'
At first I though the problem was a matter of quotes but now I think the problem is deeper. Having to do with the presence of variables.
Any help would be greatly appreciated. Thank you.
Bill Kilgore