PRB: "Record is out of Range" w/ Form from One-to-Many Wizard (135751)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
This article was previously published under Q135751 SYMPTOMS
When using a form created with the One-to-Many Wizard, you may receive the
error "Record out of Range." This error occurs if a new record is added to
both the parent and child tables.
CAUSE
The error occurs because the record pointer in the child table does appear
to be in the correct location when the command THISFORM.REFRESH is
executed.
RESOLUTION
Refresh the form before adding the record in the second table by adding
this line of code:
* Add record to parent table
IF INLIST(oAddRec.AddOption,OPT_ADD_PARENT,OPT_ADD_BOTH)
IF EMPTY(m.cPapaKey)
APPEND BLANK IN (m.cPapaAlias)
ELSE
INSERT INTO (m.cPapaAlias) ((oAddRec.KeyField)) ;
VALUES(oAddRec.KeyValue)
ENDIF
ENDIF
THISFORM.REFRESH && < ---- Add this line to fix the problem
* Add child record
IF INLIST(oAddRec.AddOption,OPT_ADD_CHILD,OPT_ADD_BOTH)
* Need to check
IF EMPTY(m.cChildKey) OR TYPE(m.cChildKey)#TYPE('oAddRec.KeyValue')
APPEND BLANK IN (m.cChildAlias)
ELSE
INSERT INTO (m.cChildAlias) ((m.cChildKey)) ;
VALUES(oAddRec.KeyValue)
ENDIF
ENDIF
STATUS
Microsoft is researching this behavior and will post new information here
in the Microsoft Knowledge Base as it becomes available.
Modification Type: | Major | Last Reviewed: | 2/15/2000 |
---|
Keywords: | KB135751 |
---|
|