Hi Pjotter,

I have DB on SQL server and i need to extract data from SQL DB to excel. Given above first code is working fine but in which only one condition is define Pname as a string value.

[VBA]Pname = ActiveSheet.Range("B3").Value[/VBA]
Pname is string value. But i want to add two more criteria start date and end date so that data only extract between given date.