Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to create auto update combo box
Message
De
19/06/2002 08:13:12
 
 
À
19/06/2002 04:26:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00670040
Message ID:
00670069
Vues:
36
Hello Tom.

I got errored out, it said something like I cannot use 'this' in a sql row source control. How can I do this now? I have tried to issue a this.parent.rowsource = sql statement. It doesn't quite work, is it me or is there a easier way or trick you guys can teach me?

You cannot use 'This' in the property sheet. But you can use 'This' if you set up the combo's RowSource in Code. So what you can do is to have a form method called SetCombos that is called from the form's Init() to set up the RowSource for the dependent combo. This way you can be sure thaty the control that it depends on has already been instantiated. If you put this code in the dependent combo's init(), you could not be sure that the control that it depends on has already been instantiated:
LOCAL lcRowSource
*** Set up the SQL statement to use as the RowSource for the detail list box
*** Select only the items that have a De_Cat_Key equal to the Item selected in the combo box
lcRowSource = 'SELECT Det_Desc, Det_Key, UPPER( Details.Det_Desc ) as UpperDesc FROM Details '
lcRowSource = lcRowSource + 'WHERE Details.De_Cat_Key = ( Thisform.cboBoss.Value ) INTO CURSOR csrDetails '
lcRowSource = lcRowSource + 'ORDER BY UpperDesc'
*** Now set up the list box's properties
WITH Thisform.lstDetails
  .RowSourceType = 3
  .RowSource = lcRowSource
  *** Don't forget to repopulate the control's internal list
  .Requery()
  *** Inialize it to display the first item
  .ListIndex = 1
ENDWITH
Then, in cboBoss.Valid(), you issue a lstDetails.Requery()

Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform