Information générale
Catégorie:
Gestionnaire d'écran & Écrans
<>
This appears to be a common problem when basing a listbox on a cursor that is updated (also happens with combos).
If you think about it, the listbox is pointing to a workarea that contains the cursor. When you rebuild the cursor from a query, there is no way to know which workarea the cursor is now in. We don't usually care if we work with the alias rather than the workarea number, but unfortunately the listbox does. The listbox can no longer access the selected table as it is no longer in the same workarea. You are quite right that it sometimes appears to work, but more often than not it will fail.
What you need to to do is 'disconnect' the listbox from the rowsource, perform the query and then reconnect:
lcOldRowSrc = thisform.pageframe.page2.listbox.rowsource
thisform.pageframe.page2.listbox.rowsource = chr(0)
select * from alias into cursor NewAlias
thisform.pageframe.page2.listbox.rowsource = lcOldRowSrc
Hope this explains what's going on.
Jason
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