Richard
Richard

Reputation: 318

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

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.

Upvotes: 1

Views: 227

Answers (1)

Richard
Richard

Reputation: 318

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.

Upvotes: 2

Related Questions