>>I created a form which had a local view.
>>
>>If I search a record, the command REQUERY() will be run. It works fine first time.
>>
>>Then, I modified the view and run the form again, a error message 'View defination has been changed.' displayed.
>>
>>I tried to delete and create the view again, the error still happened.
>>
>>Why?
>>
>>The local view:
>>Before Modified -
>>
>>SELECT ...,nField,... FROM table ...
>>
>>After Modified -
>>
>>SELECT ...,ROUND(IIF(...nField...),0),... FROM table ...
>
>You have to be careful when using IIF in a view. VFP determines the width of the columns when the view is first opened. If the two choices in the IIF don't return results with exactly the same width, you will get this error.
>
>For example if you have a field CField that is a character(5), the following will generate the error because different widths are returned.
> IIF(condition, CField, "")
>The folowing will work
> IIF(condition, CField, " ") && 5 spaces
Has VFP already determined the width of the columns if the view is set to NoDataOnLoad = .T. before REQUERY() is run?
If the nField is numeric, how to define the width?
I've used the same IIF expression in another view, it works fine. Why?
My IIF expression is:
IIF(nX = 1, nField1, nField1 * IIF(nX = 2, 1, nField2)/12)
Field Type is : nField1 - N(5), nField2 - N(4)
Is that OK?
KK