Microsoft KB Archive/149456

= FIX: Blank Child Record Added in One-to-Many Wizard Form =

Article ID: 149456

Article Last Modified on 9/30/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition

-



This article was previously published under Q149456



SYMPTOMS
If you create a form using the One-to-Many Form Wizard, or the TXTBTNS class in a form with a child grid, a blank record is added to the grid when the child key field name is different from the parent key field name.



CAUSE
The code in the TXTBTNS class of Wizstyle.vcx that adds the child record incorrectly adds a blank record.



WORKAROUND
Rename the key field in the child table to give it the same field name as the key field in the parent table. Recreate the form with the One-to-Many Form Wizard.

-or-

Change a line in the procedure code associated with the cmdAdd.click event in the Txtbtns class of Wizstyle.vcx.

The following line: IF EMPTY(m.cChildKey) OR TYPE(m.cChildKey)#TYPE('oAddRec.KeyValue') should be modified to read: IF EMPTY(m.cChildKey) OR TYPE('m.cChildKey')#TYPE('oAddRec.KeyValue')



STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual FoxPro 5.0 for Windows.



Steps to Reproduce Problem
  Create a table that has the following structure:   Name:      Table_1 Fields:   ID1        Character 10 Field2    Character 10 Field3    Character 10 Add two records to Table_1 with the values AA and BB in the ID1 field.   Create a table that has the following structure:   Name:      Table_2 Fields:   ID2        Character 10 Field2    Character 10 Field3    Character 10 Create an index on Table_2.ID2  Run the One-to-Many Form Wizard. In Step 1, choose Table_1 as the Parent table, choose ID1 as a field, and click the Next button. In Step 2, choose Table_2 as the child table, choose the >> button to select all fields, and then click Next. In Step 3, choose ID1 from the left drop-down list and ID2 from the right drop-down list to establish the relationship. Click the Finish button. Click the "Save and run form" button. Then click Finish. Save the form as Table_1.scx. After the form is displayed, click the Add button.</li> In the Add Record dialog box, choose "Add record to child (Grid) only," and click the Add button. No record will appear in the grid. A record has been added to the child table, but the key field (ID2) is blank for the added record.</li></ol>

Keywords: kbbug kbfix kbvfp500fix KB149456

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.