Knowledge Base

PRB: Error When Running Gendbc.prg

Article ID: 149125

Article Last Modified on 9/30/2003


APPLIES TO


This article was previously published under Q149125

SYMPTOMS

When you run Gendbc.prg, the following error is produced at line 722 in Visual FoxPro 3.0 and at line 834 in Visual FoxPro 3.0b:
cannot find object cust_id in the database

CAUSE

This error occurs when a database contains two views where the name of the second view matches the first part of the name of the first view. An example is a database that has a view called myview1 and a second view called myview.

WORKAROUND

To prevent this problem, alter the Gendbc.prg program file, or change the setting of EXACT. For example, type the following command in the command window:
   SET EXACT ON
				
Or type the following command in the command window:
   MODIFY Gendbc.prg.
				
In version 3.0, the offending line is 711, and in version 3.0b this line is
  1. The line reads:
       LOCATE FOR UPPER(GenViewCursor.ObjectName ) = cViewName AND ;
          GenViewCursor.Objecttype = 'View'
    						
Change this line to read:
   LOCATE FOR ALLTRIM(UPPER( GenViewCursor.ObjectName )) == cViewName AND ;
      GenViewCursor.Objecttype = 'View'
				
This change includes the ALLTRIM function to remove all trailing spaces and changes the equals to double equals to ensure that an 'Exactly Like' match is used. The first time GENDBC is run after the change, it will automatically recompile and run correctly.

STATUS

Microsoft is researching this behavior and will post new information here in the Microsoft Knowledge Base as it becomes available.

Additional query words: VFoxWin

Keywords: KB149125