Home » excel » Using date parameters in a FoxPro query through Microsoft Query/Excel

Using date parameters in a FoxPro query through Microsoft Query/Excel

Posted by: admin May 14, 2020 Leave a comment

Questions:

I’ve got a external data source setup in Microsoft Excel which queries an external FoxPro database via Microsoft Query.

One of the lines in the query is WHERE (ihead.ih_date>={d '2018-10-01'}) but I want to change this date to be a parameter driven by a cell in Excel.

I’ve tried all different combinations of where to put the ? and what to put in the cell, but they all return “Operator/operand type mismatch”.

Where should I position the ? and what should be in the cell?

Thanks.

How to&Answers:

Thanks to Alan I’ve got it working.

I looked up what DTOC does, and found I needed to add ,1 to make it indexable.

I also needed to change the excel cell to be formatted as YYYYMMDD.

Now it’s (dtoc(ihead.ih_date,1)>=?) and it works fine.