Hey guys,
New here but ive posted this on Mrexcel.com and no help there. Kind of need this in a rush and im pretty familiar with vb code, macro's and SQL.

Ive got to lookup a set of rows from a Oracle db using this SQL statement:
select count(*) from maximo.workorder where (TO_DATE('[FROM]')-workorder.targcompdate >=90) and workorder.Status in ('INPRG','WSCH') and workorder.istask ='0' and workorder.worktype = 'PM'
Now obviously the way to do this would be to add [From] in the M$ Query to set a parameter and then set that as cell B3. However the [FROM] will no longer work because it is surrounded by quotations. So you cannot pass it as a parameter into the SQL statement.

How do you get around this? One person suggested a macro, and gave me some VB code but that didn't work.

The solution needs to look at Cell B3 for its Date and then display the results in another cell.