Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting Column ControlSource to an Expression
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01365914
Message ID:
01365934
Views:
14
>Greetings all.
>
>I know that I know this, but I can't for the life of me dredge it out of my brain, so I'm figuring that if I ask here it will probably come to me seconds after I hit Send :-)
>
>I have a column in a grid and I want the ControlSource to be an expression rather than just a field. For example -
>.ControlSource = "MyUDF(MyField)"
>This is working a lot of the time but every now and then I get a "variable is not found" error even though the MyField is in the RecordSource and the RecordSource is the currently selected table. I thought that ReadOnly had something to do with it, but that doesn't seem to help. If I do -
>.ControlSource = "''+MyUDF(MyField)"
>(That's two single quotes there on the beginning) it works. It's like VFP is thinking that MyUDF(MyField) is an array reference.
>
>Does anyone know how to stop the error other than adding an empty string there at the beginning? I assume that I'd have to add 0 to numeric values etc, and since this is for some generic code, making sure that it knows the possible return value types from MyUDF is a bit tricky.
>
>Ian Simcock.

Just a WAG but I think I got this kind of stuff to work most of the time by putting () around the entire thing. ie
( UDF(MyField) )
Beer is proof that God loves man, and wants him to be happy. - Benjamin Franklin
John J. Henn
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform