Information générale
Catégorie:
Gestionnaire d'écran & Écrans
>>I have a Grid whose Recordsource is a Cursor produced via a query. One of the fields is a logical field which is displayed using a checkbox. It all displays perfectly, but it won't allow me to edit the checkboxes. It says the field is 'Read Only'. I want to allow changes to the logical field via the checkboxes. Is there a way to do this? While the other columns of the Grid are marked ReadOnly, this column is definitely not.
>
>Results of an SQL query are readonly, hence controls bound to them are readonly.If you want to edit the results and have your changes written to the underlying tables, then you need to be using an updateable view. But, if you only want to edit the results of your query and then do your own thing with them, you can use this little trick:
>
>SELECT * FROM table INTO CURSOR temp1
>USE DBF('temp1') AGAIN IN 0 ALIAS newtemp
>USE IN temp1
>
>Now, new temp is an editable cursor, and you can set your view's recordsource to it
Thanks Erik, it worked perfectly when first creating the cursor. I had a problem when I was requerying the data when the cursor was already in memory, as it showed that the alias name was already in use. I got around that by checking if the editable cursor was USED(), then if so, copying the temp cursor to an array, zapping the editable cursor and appending the array. That meant that the grid could then be refreshed without breaking the link to its datasource!
Thanks again, it was a great help
David O'Brien
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement