THISFORM.AddProperty('oGridSource') THISFORM.oGridSource = Createobject("CursorAdapter") WITH THISFORM.oGridSource .DataSourceType="ODBC" .alias="ODBC_CCS" .Datasource=Sqlstringconnect(CONNECTION_STRING) .SelectCmd="select * from supervisores" .CursorFill() ENDWITH THIS.RecordSource="ODBC_CCS"I would have my CONNECTION_STRING defined as a constant in a header file. That way, you only need to change the string in the header file instead of hunting through all your forms, code, etc., to change it in all locations.
IF PEMSTATUS('THIS', 'oGridSource', 5) THIS.oGridSource = .null. ENDIFMy preference would be to create a generic CA class in a VCX and add that CA to the DE of the form. You can populate your properties there and let the form handle the creation and destruction of the CA.