I am using VFP6.0. I have a view that contains four tables one of which is a transaction table. In the filter section of the view I want to use a variable (parameter) to query the data based on the transaction date – ie tran_date >= gdTranDate where gdTranDate=date()-N and N is supplied by the user via a radio button in the form. The radio button choices are 1 month (30days), 3 months (90 days) etc. The user selects the timeframe, in the click event gdTranDate = date()-N, requery() and then refresh the grid. Seems simple enough.
Here is the problem. The first time the query is made, and error message appears “operator/operand type mismatch”
The second time the query works as desired. In fact, every other query acts the same way – the first time, error message, second time, ok. That’s what happens in the view designer when I exercise the SQL. When I try to run the form, I get the error message again and of course it will not open. When I go back to the view designer I discover that the variable gdTranDate has quotes around it which makes it a string instead of a date. It seems that the quotes are inserted automatically when I close the view designer.
What am I missing here?
TIA
Glen Mettler
Glen_Mettler@IOL-12.NET