Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combo Bombo
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00306688
Message ID:
00306928
Vues:
32
Steve,

If you are setting rowsourcetype and rowsource to none, how are you giving the combo its list of values?

>This also makes me think that when I convert my old table into my new table with codes in fields for descriptions (someone saved whole descriptions in the old version of myfield and mytable) I could save myself tons of work in the conversion program, but I have to think it through. It's a lot of fields to convert from full descriptions to codes. Maybe I defined all of those new codes for nothing when I could have just used the Index number to auto generate the code for the description. Does this make any sense? Now I am really confused.

The problemiwht using the index for teh code is that the index can change for reasons totally outside the management of the codes. The best solution, IMO, is to create a validation table with two fields, one ics the code and the other is the description. Populate you combo from that table as RowSource and use the code field from the editing table as the Controlsource. With this approach you don't need any code anywhere and the value in the table is not tied to the index of the combo.

What's wrong with teh index of teh combo as the value of the code? Ok, you want to produce a report that lists data from the table adn uses the description istead of the code. If the codes and their descriptions are in a validation table you simply;
SELECT Table.*, Codes.Description 
  FROM Table JOIN Codes 
    ON Table.CodeField = Codes.CodeField ...
Using the combo index you will need some kind of code that will translate teh value of the field into the description. Probably built using IIF() statements that are nested. The two things bad about this are; 1) the descriptions are determined by two different and independent mechanisms at edit time versus report time and those must be kept in synch and 2) have you ever looked at a series of nested IIF()'s, they both not pretty and not easy to decipher. Compare the SELECT above with this field expression for a field in the report;

IIF(Field=1,"Apples",IIF(Field=2,"Pears",IIF(Field=3,"Oranges",IIF(Field=4,"Bananas",IIF(Field=5,"Kiwis",IIF(Field=6,"Tomatoes",IIF(Field=7,"Grapes","Unknown Fruit")))))))

Now tell me, are all the commas right? Are the Parens balanced? What do I do when the user asks that the combo be in alphabetical order or any particular order (changing the order will change the index values for the items)?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform