>>Esparta,
>>For what it's worth I'd add a property named CursorName :
>.CursorName = sys(2015)
>.RecordSource = "SELECT * from Customer INTO CURSOR "+.CursorName
>
>It is for a generic enhaced Grid Class, I now I can use the property, but I just want to save some brain cells <g> I mean, no have to remember to fill the cursor name I suppose to get, just do it as I been done in this time: Setting recordSource & RecordSourceType, the hard work will be done by the GridClass knowing the real binded cursor no matter if it was an Alias, DBF o SQL Statement.
>
>Now I'm seeing this is not so easy as I though, so I'll have to use the property anyway. I already try the Vlad's recomendation with no hit :(
Esparta,
I say use a property because 'been there done that' :)
Checking controlsource works, however you should do that at a point and on a column which you're sure not touched (controlsource might not be in form usedalias.fieldname) yet. To workaround the issue I did this (roughly) :
with myGrid
lnRecType = .recordsourcetype
lcRecordsource = .recordsource
.recordsource = ''
endwith
if lnRecType > 2
thisform.addobject('dummy','grid')
with thisform.dummy
.recordsourcetype = lntype
.recordsource = lcRecordsource
lcCursorName = juststem(.columns(1).controlsource)
endwith
thisform.removeobject('dummy')
else
lcCursorName = .recordsource
endif
myGrid.RecordSource = lcRecordsource
In most cases it doesn't worth to do all these (like using a sys(2015) for cursorname). I could just store it to a property :)
Cetin