Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Hi Ken,
>I'm filling arrays with fields from tables and using them in combos. The only way I can get it to work is (do I have to admit this) to initialize them in the load event as Public variables.
You can add custom properties to your form and use those, then there are know variables to release and you are using an OO solution. To create the propeties, in the FOrm Designer, click on Form>New Property and call it Field1 or the actualy name of the field (whatever).
THen instead of:
*Form.Load()
PUBLIC field1
Field1 = Mytable.Myfield1
you can do:
*Form.Load()
This.Field1 = Mytable.Myfield1
Then to access it in any form method or control method you can do:
?This.Field1
In your case, you need to make the property an array, no problem, just type in "Fields[1]" in the New Property Dialog Box.
Also. it sounds like you can use an SQL Select as the record source instead of arrays. I presume that your combo box shows current value in a field? Then you would set the Combo's RecordSourceType to SQL Select. and put "SELECT Field1 FROM Table1 GROUP BY Field1 INTO CURSOR cCombo1" in the RecordSource. If you still want to use a form property-array for the control source, you can still use the SELECT to populate it:
SELECT Field1 FROM Table1 GROUP BY Field1 INTO ARRAY Thisform.aFields
Does this help?
Précédent
Suivant
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