Article ID: 250669
Article Last Modified on 8/27/2002
APPLIES TO
- Microsoft Visual FoxPro 6.0 Professional Edition
This article was previously published under Q250669
SYMPTOMS
When you generate a One to Many form with the Microsoft Visual FoxPro 6.0 Form Wizard and attempt to add a record into the parent table with a key value that already exists, you might receive the error message listed below:
Click the OK button three times and another error message appears:
Click the OK button and another error message appears:
RESOLUTION
As a workaround, you can add the following code to the AddRec method of the txtBtns class. The txtBtns class can be found in VFP98\Wizards\wizbtns.vcx.
- On the Tools menu, open the Class Browser.
- Click the Open button, locate wizbtns.vcx, and click OK.
- Click on txtbtns in the left pane of the Class Browser.
- Expand the Methods in the right pane and double-click on the AddRec method.
Go to line 29. This should be a blank line. The line above it should be:
* Start of Code THIS.OldRec = RECNO() &&save record in case reverting * End of Code
Add the following code:
* Start of Code * Changes to prevent lnSaveAlias3 and lnSaveRec3 errors if added record already exists lnSaveAlias3 = ALIAS() lnSaveRec3 = RECNO() * End of Code
- Save wizbtns.vcx.
MORE INFORMATION
Steps to Reproduce Behavior
- Run the Component Gallery.
- Open the folder named Visual FoxPro Catalog/Foundation Classes/Buttons.
- Select Data Edit Buttons and right click on it.
- Select View Sample, and then Run from the context menu. (If View Sample is disabled, set your Tools/Options/File Locations/samples directory correctly.)
- Click the Add/Save Record button.
- Click the Add record to both option.
- Type in ALFKI, and then click the Add button. Note that the errors listed in the "Symptoms" section occur.
(c) Microsoft Corporation 2000, All Rights Reserved. Contributions by Mark Barnard, Microsoft Corporation.
Keywords: kbcodesnippet kbdatabase kbprb kbwizard kbpending KB250669