>>I have a grid based on a view with a parameter called nUserGroup. View is bugffering set to 5.
>>
>>It is set as public in the form.
>>
>>I have a combobox that in the lostfocus event takes its value and requeries the view.
>>i.e.
>>nUserGroup=this.value
>>select (UserGroupItems)
>>=requery()
>>
>>Then the resultant view is displayed in a grid.
>>The grid is setup by default as readonly.
>>
>>When I click in any column I get the above error
>>i.e. Record is out of range, (5)
>>If I look in the debug mode. it is occuring in the mousedown event of the grid.
>>In the debugger, the alias() is the grid record source, i.e. the view...
>>the number of records reccount() is 1, and the recno() is 1 as well.
>>
>>What does this mean out of range... isn't 1 in range?
>>
>>What am I doing wrong??
>>
>>TIA,
>>Mike
>
>try
>
>
>nUserGroup=this.value
>select (UserGroupItems)
>=requery()
>grid.setfocus
>
Thanks Fabio... that is the code I am using. The problem is when I Click on a field in the grid, I get the error. The columns in the grid are populated by:
a combobox, populated via an SQL statement. It's column is bound to the underlying data source. The other 7 columns are check boxed.
The combobox has a property, cGridAlias, which is set in its init to be equal to the source table for the grid. In the lost focus event, I select (.cGridAlias) aqs the last line of the code. The error does not appear until I click on one of the checkboxes. By default the grid is set as readonly=.t. until I unlock it.
In the init of the grid, I run a BldGrid method that adds the combobox and the check boxes to the appropiate columns. Then a routine runs called SetGrid to fill in the properties for the columns, i.e. width, controlsource, activecontrol etc. The final routine run upon init, resizes the grid.
Any other ideas, anyone?
Mike