So I am accessing an MSAccess database using PDO (ODBC). I am trying to get all records from the current week NOT the past seven days. Here is my query:
SELECT *
FROM tblBilling
WHERE ((
Year(DateOfService) = Year(Date())
And DatePart("ww", DateOfService, 0) = DatePart("ww", Date(), 0)
))
ORDER BY DateOfService, TimeOfService
Obviously this works in MSAccess, but when using it from the web app I get the following error:
SQLSTATE[07002]: COUNT field incorrect:
-3010 [Microsoft][ODBC Microsoft Access Driver]
Too few parameters. Expected 1.
(SQLExecute[-3010] at ext\pdo_odbc\odbc_stmt.c:254)
I can't seem to figure this out. I must be overlooking something and my brain is now turning to mush. I know if I remove DataPart it will run the query and not return an error, but then it will not do what I need it to do.
Thanks for all the help!
Extra code as requested:
try
{
$pdo = new PDO('odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq='.DB_NAME.';Uid=');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$myPDO = $pdo->prepare($query);
$myPDO->execute();
$result = $myPDO->fetchAll();
} catch(PDOException $e)
{
echo $e->getMessage();
}

WHEREstatement.