General information
Category:
Forms & Form designer
Title:
Setting Column ControlSource to an Expression
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only