Similar to the other solution above:
Here is the code that I used to process a date query
// Ready Time Begin
var sMM1, sDD1, YYYY1, sDate1;
var bdatesOK = true;
// Check if Received Date selected
if ((DDBeginDateYear.SelectedIndex > 1) || (DDBeginDateMonth.SelectedIndex > 1) ||
(DDBeginDateDay.SelectedIndex > 1) )
{
// Check if all Received Dates selected
if ((DDBeginDateYear.SelectedIndex > 1) && (DDBeginDateMonth.SelectedIndex > 1) &&
(DDBeginDateDay.SelectedIndex > 1) )
{
// Set Month
if ((DDBeginDateMonth.SelectedIndex - 1) < 10)
{
sMM1 = "0" + (DDBeginDateMonth.SelectedIndex - 1);
}
else
{
sMM1 = DDBeginDateMonth.SelectedIndex - 1;
}
// Set Day
if ((DDBeginDateDay.SelectedIndex - 1) < 10)
{
sDD1 = "0" + (DDBeginDateDay.SelectedIndex - 1);
}
else
{
sDD1 = DDBeginDateDay.SelectedIndex - 1;
}
YYYY1 = DDBeginDateYear.Item(DDBeginDateYear.SelectedIndex);
var sDate1;
sDate1 = sMM1 + "/" + sDD1 + "/" + YYYY1;
var lDate1 = ActiveDocument.Sections["PO Package SubQuery"].Limits.CreateLimit("batch_report_data.ORD_INIT_DT"

;
lDate1.Operator = bqLimitOperatorGreaterThanOrEqual;
lDate1.CustomValues.Add(sDate1);
lDate1.SelectedValues.Add(sDate1);
POQuery.Limits.Add(lDate1);
var lDate11 = ActiveDocument.Sections["Package Origination Product SubQuery"].Limits.CreateLimit("batch_report_data.ORD_INIT_DT"

;
lDate11.Operator = bqLimitOperatorGreaterThanOrEqual;
lDate11.CustomValues.Add(sDate1);
lDate11.SelectedValues.Add(sDate1);
POQuery2.Limits.Add(lDate11);
// Add sDate1 to Results page
ActiveDocument.Sections["Package Origination Results"].Shapes["DateRange"].Text=sDate1;
}
else
{
Application.Alert("Invalid Begin Date entered"

;
bdatesOK = false;
}
}
else
{
Application.Alert("Begin Date required"

;
bdatesOK = false;
}
// Ready Time End
var MM1e, DD1e, YYYY1e;
// Check if Received Date selected
if ((DDEndDateYear.SelectedIndex > 1) || (DDEndDateMonth.SelectedIndex > 1) ||
(DDEndDateDay.SelectedIndex > 1) )
{
if ((DDEndDateYear.SelectedIndex > 1) && (DDEndDateMonth.SelectedIndex > 1) &&
(DDEndDateDay.SelectedIndex > 1) )
{
// Set Month
if ((DDEndDateMonth.SelectedIndex - 1) < 10)
{
MM1e = "0" + (DDEndDateMonth.SelectedIndex - 1);
}
else
{
MM1e = DDEndDateMonth.SelectedIndex - 1;
}
// Set Day
if ((DDEndDateDay.SelectedIndex - 1) < 10)
{
DD1e = "0" + (DDEndDateDay.SelectedIndex - 1);
}
else
{
DD1e = DDEndDateDay.SelectedIndex - 1;
}
YYYY1e = DDEndDateYear.Item(DDEndDateYear.SelectedIndex);
var sDate1e;
sDate1e = MM1e + "/" + DD1e + "/" + YYYY1e;
var lDate1e = ActiveDocument.Sections["PO Package SubQuery"].Limits.CreateLimit("batch_report_data.ORD_INIT_DT"

;
lDate1e.Operator = bqLimitOperatorLessThanOrEqual;
lDate1e.CustomValues.Add(sDate1e);
lDate1e.SelectedValues.Add(sDate1e);
POQuery.Limits.Add(lDate1e);
var lDate11e = ActiveDocument.Sections["Package Origination Product SubQuery"].Limits.CreateLimit("batch_report_data.ORD_INIT_DT"

;
lDate11e.Operator = bqLimitOperatorLessThanOrEqual;
lDate11e.CustomValues.Add(sDate1e);
lDate11e.SelectedValues.Add(sDate1e);
POQuery2.Limits.Add(lDate11e);
// Add sDate1e to Results page
ActiveDocument.Sections["Package Origination Results"].Shapes["DateRange2"].Text= "- " + sDate1e;
if (YYYY1 > YYYY1e)
{
Application.Alert("End Date must be after Received Begin Date1"

;
bdatesOK = false;
}
else if ((YYYY1 == YYYY1e) && (sMM1 > MM1e))
{
Application.Alert("End Date must be after Received Begin Date2"

;
bdatesOK = false;
}
else if ((YYYY1 == YYYY1e) && (sMM1 == MM1e) && (sDD1 >= DD1e))
{
Application.Alert("End Date must be after Received Begin Date3"

;
bdatesOK = false;
}
}
}
I hope this helps