* Program...........: CopyToCursor * Author............: Esparta Palma * Created...........: 09.23.2005 11:28 AM * Copyright.........: (c) Freeware *) Description.......: Create a cursor bases on any table (or cursor) or *) : actual area if not used second parameter into the *) : desired cursor. * Calling Samples...: m.TotalFields = CopyToCursor("cCustomer","Customer") *) : m.TotalFields = CopyToCursor("cCustomer") * Parameter List....: tcCursor -> The name of the cursor to create *) : tcAlias -> The source alias * Returns...........: Any positive number if sucefull (the numbers of *) : created fields in the cursor) *) : Any negative number if error (the Error number) * Major change list.: *-------------------------------------------------------------------------------------------------- FUNCTION CopyToCursor LPARAMETERS tcCursor,tcAlias LOCAL nRetValue IF (VARTYPE(m.tcAlias) # 'C') OR (EMPTY(m.tcAlias)) m.tcAlias = ALIAS() ENDIF TRY m.nRetValue = AFIELDS(laFields,m.tcAlias) CREATE CURSOR (tcCursor) FROM ARRAY laFields CATCH TO oError m.nRetValue = oError.ErrorNo * -1 ENDTRY RETURN m.nRetValue ENDFUNCHTH.