I'm using a TADODataset and dynamically creating the SQL. The TADOConnection connects to an Access 2000 database using OLEDB 4.0 Provider.
The code that tries to dynamically create the SQL is as follows:
The query returns 0 records using the sSQL as the commandText property. Yet when I evaluate the expression which returns the following statement:
and copy and paste into Access Query Designer SQL view, it returns the correct amount of records.
Anyone know what's going on here and how I can dynamically create the SQL.
Thanks,
Bill N
P.s. [Class Registration].Year is a datetime field and NO I was not the programmer who named a datetime field "Year".
The code that tries to dynamically create the SQL is as follows:
Code:
sDate:=FormatDateTime('mm/dd/yyyy',FArchiveDate);
sSQL:=Format('SELECT * FROM [%s] WHERE [%s].%s < #%s#',[FTblName,FTblName,FDateField,sDate]);
The query returns 0 records using the sSQL as the commandText property. Yet when I evaluate the expression which returns the following statement:
Code:
SELECT * FROM [Class Registration] WHERE [Class Registration].Year < #09/02/2000#
Anyone know what's going on here and how I can dynamically create the SQL.
Thanks,
Bill N
P.s. [Class Registration].Year is a datetime field and NO I was not the programmer who named a datetime field "Year".