Microsoft KB Archive/131218

{| = BUG: "Missing )" Error Message Produced by Valid Expression =
 * width="100%"|

ID: Q131218

The information in this article applies to:


 * Microsoft FoxPro for Windows, version 2.6a

SYMPTOMS
A "Missing )" error message is produced when a valid expression is used with an ON routine such as ON ERROR or ON KEY LABEL.

CAUSE
The algorithm that parses expressions used with an ON routine cannot parse expressions that exceed 255 characters in length.

RESOLUTION
Rearrange the code so that a short expression is placed after the ON routine. For example, instead of this:

ON ERROR  restructure the statement so a function that contains the code is called: ON ERROR =myfunction FUNCTION myfunction  RETURN .T. See the "Steps to Resolve Problem" section in this article for an example.

STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Steps to Reproduce Problem
1. Create the following procedures and functions inside a file called

ETEST.PRG:

PROCEDURE ctest

WAIT WINDOW "done test"

RETURN

FUNCTION vlog PARAMETERS one,two RETURN ""

FUNCTION ccallstk PARAMETERS one,two RETURN "" 2. Place the following code in a file called ESTART.PRG: ON ERROR =vLog( 'FATAL', ;           'FoxPro error #' + ltrim( str( error ) ) + ;             ': ' + message + chr( 13 ) + chr( 10 ) + chr( 13 ) + ;             chr( 10 ) + 'Program: ' + program + chr( 13 ) + ;             chr( 10 ) + 'Line #: ' + ltrim( str( lineno ) ) + ;             chr( 13 ) + chr( 10 ) + 'Line: ' + message( 1 ) + ;             chr( 13 ) + chr( 10 ) + 'Call Stack: ' + cCallStk( ',' ) ) 3. In the Command window, type: SET PROCEDURE TO etest DO estart x You may receive the following error message when executing "DO estart" or when the "x" is entered into the command window: "Missing )"

Steps to Resolve Problem
1. Rearrange the code as follows to avoid the error. Modify the code in

ETEST.PRG to be:

PROCEDURE ctest

=vLog( 'FATAL', ;          'FoxPro error #' + ltrim( str( error ) ) + ;            ': ' + message + chr( 13 ) + chr( 10 ) + chr( 13 ) + ;            chr( 10 ) + 'Program: ' + program + chr( 13 ) + ;            chr( 10 ) + 'Line #: ' + ltrim( str( lineno ) ) + ;            chr( 13 ) + chr( 10 ) + 'Line: ' + message( 1 ) + ;            chr( 13 ) + chr( 10 ) + 'Call Stack: ' + cCallStk( ',' ) )

WAIT WINDOW "done test"

RETURN

FUNCTION vlog PARAMETERS one,two RETURN ""

FUNCTION ccallstk PARAMETERS one,two RETURN "" 2. In the Command window, type: SET PROCEDURE TO etest ON ERROR =ctest x Additional reference words: FoxWin 2.60a buglist2.60a KBCategory: kbprg kbbuglist kbnetwork KBSubcategory: FxprgMultiuser
 * }