Hiya everybody
I'm having a bit of trouble with an SQL statement and I wondered if anyone knew where I was Going wrong. I want to extract data from a table. The user can specify dates between which the data will be displayed.
The user inputs the start and end dates which are place into the variables 'Starter' and 'Ender'.
When I try to run the search I get the following error message:
"Missing right parenthesis"
Heres my SQL Statemet ( it is one long line ):
cmmSQL = "SELECT StartDateTime, EndDateTime, DurationSecs, CallersNumber, DialledNumber,TerminatingNumber, ValuePence
FROM Opal_Data
WHERE TerminatingNumber = '" & PRSselecta & "'
AND
StartDateTime >=TODATE(" & Starter & ",DD/MM/YYYY HH:MM:SS)
AND
EndDateTime <=TODATE(" & Ender & ", DD/MM/YYYY HH:MM:SS) "
Set rsCDR = cnAcqAcc.Execute(cmmSQL)
rsCDR.MoveFirst
Any Help appreciated!
Cheers 'n' Beers
Skeen




Reply With Quote