PRB: Error "Record is not Locked" with ComboBox in Grid (170919)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft Visual FoxPro for Windows 3.0b
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
- Microsoft Visual FoxPro for Macintosh 3.0b
This article was previously published under Q170919 SYMPTOMS
When you place a combobox in a grid, the following error might occur when
you choose an item from the combobox:
Record is not locked
If the RowSourceType is set to 6-Fields and the RowSource of the combobox
is set to a field in the same table that the grid is bound to, then the
error will occur.
RESOLUTION
Add the records of the field that the combobox is based on to an array and
then basing the RowSource of the combobox on the array to prevent the error
from occurring. You can also use a RowSourceType of 3-SQL Statement as
another option.
To modify the form created in the Steps to Reproduce Behavior section
below, make these changes to the form:
- From the Form menu, choose New Property. Type in "testarray[1,1]"
(without quotes) as the name of the new property. Click Add.
- In the Load method of the form, place the following code to populate
the array:
SELECT company FROM customer INTO ARRAY Thisform.testarray ORDER BY 1
A modified version of the above SELECT statement can be used if the
RowSourceType of the combobox is 3-SQL Statement. The modified
statement below would be put in for the RowSource property:
SELECT company FROM customer INTO CURSOR test ORDER BY 1
Note that using a RowSourceType of either 3-SQL Statement or 5-Array will
change the value in the customer field of the table. This happens because
the control source property of the column is set to that field by default
when the grid is created. With the RowSourceType of 6-Fields, the customer
field is not changed. The combobox acts as a navigation control in this
case. This would be redundant since the grid itself can be used as a
navigation control.
STATUS
Microsoft is researching this problem and will post new information here in
the Microsoft Knowledge Base as it becomes available.
Modification Type: | Major | Last Reviewed: | 5/12/2003 |
---|
Keywords: | kbprb KB170919 |
---|
|