Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting Column ControlSource to an Expression
Message
From
08/12/2008 05:28:03
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Setting Column ControlSource to an Expression
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01365914
Message ID:
01365914
Views:
60
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.
Next
Reply
Map
View

Click here to load this message in the networking platform