DoCmd method

Executes one or more command line(s) and returns the error code.

Syntax

nError = Document.DoCmd( cLines )

Parameter

cLines

One or more line(s) of Visual FoxPro Code to be executed. Multiple lines must be separated through CHR(13)+CHR(10) or CHR(13). Since the code will be run in macro substitution, it may not include control structures that can span multiple lines. This includes IF…ENDIF, FOR…ENDFOR, SCAN…ENDSCAN, etc. The code is executed during the data session of the Server object. Hence there is no access to tables opened inside the AFP document.

Return

Executing the Visual FoxPro lines generates an error code, and this will be returned as a numerical value. If no error was triggered this return will be 0. The execution of the command line will be interrupted at the occurrence of the first error. There is no facility to determine which line caused the error.